BEGIN TRANSACTION;

DROP TABLE IF EXISTS users;
CREATE TABLE users (
    id serial PRIMARY KEY,
    username text NOT NULL,
    date_joined timestamp,
    password text NOT NULL);

DROP TABLE IF EXISTS posts;
CREATE TABLE posts (
    id serial PRIMARY KEY,
    title text NOT NULL,
    text text NOT NULL,
    date timestamp,
    user_id integer REFERENCES users.id,
);

COMMIT;