apps: sql + get valid one, get by id, insert, generate app id, generate secret
This commit is contained in:
parent
b5c2be6c9f
commit
71b083895d
19 changed files with 490 additions and 0 deletions
1
crates/database/migrations/20230314174914_apps.down.sql
Normal file
1
crates/database/migrations/20230314174914_apps.down.sql
Normal file
|
|
@ -0,0 +1 @@
|
|||
drop table if exists apps;
|
||||
22
crates/database/migrations/20230314174914_apps.up.sql
Normal file
22
crates/database/migrations/20230314174914_apps.up.sql
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue