diff options
Diffstat (limited to 'db/0-create.psql')
| -rwxr-xr-x | db/0-create.psql | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/db/0-create.psql b/db/0-create.psql index 732c986..39b4efd 100755 --- a/db/0-create.psql +++ b/db/0-create.psql @@ -1,20 +1,19 @@ CREATE TABLE users ( - user_id integer PRIMARY KEY, + user_id SERIAL PRIMARY KEY, nick text UNIQUE NOT NULL, + hash text NOT NULL, email text NOT NULL, - salt integer NOT NULL, - password_hash text NOT NULL, - created_on timestamp NOT NULL + created_on timestamp NOT NULL DEFAULT now() ); CREATE TABLE rooms ( - room_id integer PRIMARY KEY, + room_id SERIAL PRIMARY KEY, name text UNIQUE NOT NULL, created_on timestamp NOT NULL ); CREATE TABLE messages ( - message_id integer PRIMARY KEY, + message_id SERIAL PRIMARY KEY, user_id integer NOT NULL REFERENCES users, room_id integer NOT NULL REFERENCES rooms, content text NOT NULL, @@ -22,8 +21,8 @@ CREATE TABLE messages ( ); CREATE TABLE user_session ( - session_id integer PRIMARY KEY, - user_id NOT NULL REFERENCES users, + session_id bigint PRIMARY KEY, + user_id integer NOT NULL REFERENCES users, id_address text NOT NULL, ttl timestamp NOT NULL );
\ No newline at end of file |
