PRAGMA foreign_keys = ON; drop table if exists login; drop table if exists user; drop table if exists userstatus; create table userstatus( status char(1) primary key not null, description varchar(32) not null ); insert into userstatus values( 'U', 'User unknown' ); insert into userstatus values( 'R', 'Currently in registration' ); insert into userstatus values( 'A', 'Registration ok, user active' ); insert into userstatus values( 'D', 'User disabled' ); create table user( id integer primary key autoincrement not null, username varchar(32) unique not null, printname varchar(32), password varchar(32) not null, email varchar(32), status char(1) references userstatus(status) default 'U', registration_start timestamp, code varchar(32) ); -- dangerous, disable default admin if necessary insert into user( username, printname, password, status ) values( 'admin', 'The Root', 'admin', 'A' ); create table login( id integer primary key autoincrement not null, user_id integer references user(id), last_login timestamp ); create table page( id integer primary key autoincrement not null, slug varchar(32) not null, title varchar(32) not null, content text, unique( slug ) );