create table if not exists apps
(
    id              TEXT    not null primary key,
    created_at      TEXT    not null default CURRENT_TIMESTAMP,
    updated_at      TEXT    not null default CURRENT_TIMESTAMP,
    label           TEXT    not null,
    redirect_uri    TEXT    not null,
    secret          TEXT    not null,
    is_confidential INTEGER not null,
    is_archived     INTEGER not null default 0
);

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