CREATE TABLE users (
  id integer primary key asc,
  name text,
  pubkey text,
  created timestamp default current_timestamp
);

CREATE TABLE authentications (
  user integer,
  salt text,
  foreign key(user) references users(id)
);

CREATE TABLE threads (
  id integer primary key asc,
  created timestamp default current_timestamp
);

CREATE TABLE posts (
  id integer primary key asc,
  user integer,
  thread integer,
  content text,
  created timestamp default current_timestamp,
  foreign key(user) references users(id),
  foreign key(thread) references threads(id)
);

INSERT INTO threads default values;