summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorsostler <sbostler@gmail.com>2009-11-22 14:57:44 -0500
committersostler <sbostler@gmail.com>2009-11-22 14:57:44 -0500
commit49ead645c7f78d38ef3ddc0e67a9ff6cc1b846f8 (patch)
treea49b98fad2bc556da0eae74eb41a51113fd07cef /db
parent6918b41c1c24720b71429c925732ea9081c42b7c (diff)
static/index.html
Diffstat (limited to 'db')
-rwxr-xr-xdb/0-create.psql29
1 files changed, 29 insertions, 0 deletions
diff --git a/db/0-create.psql b/db/0-create.psql
new file mode 100755
index 0000000..732c986
--- /dev/null
+++ b/db/0-create.psql
@@ -0,0 +1,29 @@
+CREATE TABLE users (
+ user_id integer PRIMARY KEY,
+ nick text UNIQUE NOT NULL,
+ email text NOT NULL,
+ salt integer NOT NULL,
+ password_hash text NOT NULL,
+ created_on timestamp NOT NULL
+);
+
+CREATE TABLE rooms (
+ room_id integer PRIMARY KEY,
+ name text UNIQUE NOT NULL,
+ created_on timestamp NOT NULL
+);
+
+CREATE TABLE messages (
+ message_id integer PRIMARY KEY,
+ user_id integer NOT NULL REFERENCES users,
+ room_id integer NOT NULL REFERENCES rooms,
+ content text NOT NULL,
+ created_on timestamp NOT NULL
+);
+
+CREATE TABLE user_session (
+ session_id integer PRIMARY KEY,
+ user_id NOT NULL REFERENCES users,
+ id_address text NOT NULL,
+ ttl timestamp NOT NULL
+); \ No newline at end of file