1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
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,
password varchar(32) not null,
status char(1) references userstatus(status) default 'U',
registration_start timestamp,
code varchar(32)
);
insert into user(username, password, status) values('admin','admin', 'A');
create table login(
id integer primary key autoincrement not null,
user_id integer references user(id),
last_login timestamp
);
|