added database crate, "settings" with migrations and queries, running migrations on web startup

This commit is contained in:
Philippe Loctaux 2023-02-27 16:07:18 +01:00
parent f60eb616d3
commit 9c2b43ec3c
16 changed files with 357 additions and 1 deletions

View file

@ -0,0 +1 @@
drop table if exists settings;

View file

@ -0,0 +1,20 @@
create table if not exists settings
(
id INTEGER not null primary key check ( id = 0 ),
created_at TEXT not null default CURRENT_TIMESTAMP,
updated_at TEXT not null default CURRENT_TIMESTAMP,
business_name TEXT,
business_logo BLOB
);
-- update "updated_at"
create trigger if not exists settings_updated_at
after
update
on settings
for each row
begin
update settings
set updated_at = CURRENT_TIMESTAMP
where id is NEW.id;
end;