]> Dogcows Code - chaz/chatty/blobdiff - db/schema.sql
fixed sqlite schema timestamp identifier
[chaz/chatty] / db / schema.sql
index 7fd9824cf3e213289c8d5858dcc24ca041ae5e73..fee4063c1152baf247785b5a5c1884fc5f1ee53a 100644 (file)
@@ -1,18 +1,26 @@
 
 PRAGMA foreign_keys = ON;
 
+CREATE TABLE room (
+       id              INTEGER PRIMARY KEY,
+       name            TEXT UNIQUE,
+       created         TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+);
+
 CREATE TABLE account (
        id              INTEGER PRIMARY KEY,
        email           TEXT,
        username        TEXT UNIQUE,
        password        TEXT NOT NULL,
-       status          TEXT DEFAULT 'active'
+       status          TEXT DEFAULT 'active',
+       current_room    INTEGER REFERENCES room(id)
 );
 
 CREATE TABLE message (
        id              INTEGER PRIMARY KEY,
-       posted          TIMESTAMP,
+       posted          TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
        author          INTEGER REFERENCES account(id),
+       room            INTEGER REFERENCES room(id),
        content         TEXT
 );
 
This page took 0.016909 seconds and 4 git commands to generate.