create table if not exists users
(
    id               TEXT    not null primary key,
    created_at       TEXT    not null default CURRENT_TIMESTAMP,
    updated_at       TEXT    not null default CURRENT_TIMESTAMP,
    is_admin         INTEGER not null,
    username         TEXT    not null unique,
    name             TEXT,
    email            TEXT unique,
    password         TEXT,
    password_recover TEXT,
    paper_key        TEXT,
    is_archived      INTEGER not null default 0
);

-- update "updated_at"
create trigger if not exists users_updated_at
    after update
    on users
    for each row
begin
    update users
    set updated_at = CURRENT_TIMESTAMP
    where id is NEW.id;
end;
