summaryrefslogtreecommitdiff
path: root/db/0-create.psql
diff options
context:
space:
mode:
authorsostler <sbostler@gmail.com>2009-11-24 23:43:43 -0500
committersostler <sbostler@gmail.com>2009-11-24 23:43:43 -0500
commit105ef5e0142d33c0dc24f7f0422f279e4ef1fc23 (patch)
treea85a0d5313269c2e3fb2ddcb3c974b0e020a57af /db/0-create.psql
parent40a57a474294244832a6023a10592a38a6178b91 (diff)
Added persistent rooms
Diffstat (limited to 'db/0-create.psql')
-rwxr-xr-xdb/0-create.psql14
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