drop table if exists users;
create table users (
    id integer primary key autoincrement,
    user_name string not null,
    password string not null,
    last_seen timestamp default CURRENT_TIMESTAMP,
    birthday string,
    nameday string,
    notify boolean default 1,
    email string,
    phone string,
    address_line1,
    address_line2,
    address_city_line,
    timezone string,
    kado string
);

drop table if exists news;
create table news (
    id integer primary key autoincrement,
    title string not null,
    date timestamp default CURRENT_TIMESTAMP,
    content string not null,
    content_cache string 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 string,
    content_cache string not null,
    user_id integer,
    news_id integer,
    FOREIGN KEY(user_id) REFERENCES users(id),
    FOREIGN KEY(news_id) REFERENCES news(id)
);
