lemmy/migrations/2019-02-26-002946_create_user/up.sql
Dessalines be1389420b
Adding SQL format checking via pg_format / pgFormatter (#3740)
* SQL format checking, 1.

* SQL format checking, 2.

* SQL format checking, 3.

* SQL format checking, 4.

* SQL format checking, 5.

* Running pg_format

* Getting rid of comment.

* Upping pg_format version.

* Using git ls-files for sql format check.

* Fixing sql lints.

* Addressing PR comments.
2023-08-02 12:44:51 -04:00

26 lines
713 B
SQL

CREATE TABLE user_ (
id serial PRIMARY KEY,
name varchar(20) NOT NULL,
fedi_name varchar(40) NOT NULL,
preferred_username varchar(20),
password_encrypted text NOT NULL,
email text UNIQUE,
icon bytea,
admin boolean DEFAULT FALSE NOT NULL,
banned boolean DEFAULT FALSE NOT NULL,
published timestamp NOT NULL DEFAULT now(),
updated timestamp,
UNIQUE (name, fedi_name)
);
CREATE TABLE user_ban (
id serial PRIMARY KEY,
user_id int REFERENCES user_ ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
published timestamp NOT NULL DEFAULT now(),
UNIQUE (user_id)
);
INSERT INTO user_ (name, fedi_name, password_encrypted)
VALUES ('admin', 'TBD', 'TBD');