summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rwxr-xr-xdb/0-create.psql14
1 files changed, 6 insertions, 8 deletions
diff --git a/db/0-create.psql b/db/0-create.psql
index 7bcffe6..be404be 100755
--- a/db/0-create.psql
+++ b/db/0-create.psql
@@ -12,7 +12,8 @@ CREATE TABLE users (
CREATE TABLE rooms (
room_id SERIAL PRIMARY KEY,
name text UNIQUE NOT NULL,
- created_on timestamp NOT NULL DEFAULT now()
+ created_on timestamp NOT NULL DEFAULT now(),
+ admin_only bool NOT NULL DEFAULT false
);
CREATE TABLE messages (
@@ -21,14 +22,11 @@ CREATE TABLE messages (
room_id integer NOT NULL REFERENCES rooms,
content text NOT NULL,
created_on timestamp NOT NULL DEFAULT now(),
- is_image bool
+ is_image bool NOT NULL
);
-CREATE TABLE user_session (
- session_id bigint NOT NULL,
- user_id integer NOT NULL REFERENCES users,
- ttl timestamp NOT NULL,
- PRIMARY KEY (session_id, user_id)
-);
+CREATE INDEX user_id_idx ON messages (user_id);
+CREATE INDEX room_id_idx ON messages (room_id);
+CREATE INDEX created_on_idx ON messages (created_on);
INSERT INTO rooms (room_id, name) VALUES (1, 'dumpfm'); \ No newline at end of file