-- Up

CREATE TABLE Thread(
    id INTEGER PRIMARY KEY,
    author INTEGER NOT NULL,
    name STRING NOT NULL,
    creationdate INTEGER,
    description STRING
);

CREATE TABLE Message (
    id INTEGER PRIMARY KEY,
    text STRING NOT NULL,
    subject STRING,
    creationdate INTEGER NOT NULL,
    thread INTEGER NOT NULL,
    author INTEGER NOT NULL
);

CREATE TABLE User (
    id INTEGER PRIMARY KEY,
    username STRING UNIQUE NOT NULL,
    password STRING NOT NULL,
    creationdate INTEGER NOT NULL
);


-- Down

DROP TABLE Message;
DROP TABLE User;
DROP TABLE Thread;