summaryrefslogtreecommitdiff
path: root/db/0-create.psql
diff options
context:
space:
mode:
authorsostler <sbostler@gmail.com>2009-11-23 00:18:13 -0500
committersostler <sbostler@gmail.com>2009-11-23 00:18:13 -0500
commit40a57a474294244832a6023a10592a38a6178b91 (patch)
treed54ed4c460428ad391a1ed4f39990d2e8d20f868 /db/0-create.psql
parentf6f4074a5a49f50e8ace54e88d199fa7ad8868b7 (diff)
parent2c13339226f73621c9c539fbe93c8ac6333bbf48 (diff)
Registration
Diffstat (limited to 'db/0-create.psql')
-rwxr-xr-xdb/0-create.psql15
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