aboutsummaryrefslogtreecommitdiffstats
path: root/schema.sql
blob: edf9a895ea24a1569b033cb215915c7ae7da9be0 (plain)
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
33
34
35
36
37
38
39
40
drop table if exists users;
create table users (
    id integer primary key autoincrement,
    user_name text not null,
    password text not null,
    last_seen timestamp default CURRENT_TIMESTAMP,
    birthday text,
    nameday text,
    notify boolean default 1,
    email text,
    phone text,
    address_line1 text,
    address_line2 text,
    address_city_line text,
    timezone text,
    kado text
);

drop table if exists news;
create table news (
    id integer primary key autoincrement,
    title text not null,
    date timestamp default CURRENT_TIMESTAMP,
    content text not null,
    content_cache text not null,
    user_id integer,
    FOREIGN KEY(user_id) REFERENCES users(id)
);

drop table if exists comments;
create table comments (
    id integer primary key autoincrement,
    date timestamp default CURRENT_TIMESTAMP,
    content text,
    content_cache text not null,
    user_id integer,
    news_id integer,
    FOREIGN KEY(user_id) REFERENCES users(id),
    FOREIGN KEY(news_id) REFERENCES news(id)
);