diff options
Diffstat (limited to 'db/0-create.psql')
| -rwxr-xr-x | db/0-create.psql | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/db/0-create.psql b/db/0-create.psql index 39b4efd..d34ccdd 100755 --- a/db/0-create.psql +++ b/db/0-create.psql @@ -9,7 +9,7 @@ CREATE TABLE users ( CREATE TABLE rooms ( room_id SERIAL PRIMARY KEY, name text UNIQUE NOT NULL, - created_on timestamp NOT NULL + created_on timestamp NOT NULL DEFAULT now() ); CREATE TABLE messages ( @@ -17,12 +17,14 @@ CREATE TABLE messages ( user_id integer NOT NULL REFERENCES users, room_id integer NOT NULL REFERENCES rooms, content text NOT NULL, - created_on timestamp NOT NULL + created_on timestamp NOT NULL DEFAULT now() ); CREATE TABLE user_session ( - session_id bigint PRIMARY KEY, + session_id bigint NOT NULL, user_id integer NOT NULL REFERENCES users, - id_address text NOT NULL, - ttl timestamp NOT NULL -);
\ No newline at end of file + ttl timestamp NOT NULL, + PRIMARY KEY (session_id, user_id) +); + +INSERT INTO rooms (room_id, name) VALUES (1, 'dumpfm');
\ No newline at end of file |
