added database crate, "settings" with migrations and queries, running migrations on web startup
This commit is contained in:
parent
f60eb616d3
commit
9c2b43ec3c
16 changed files with 357 additions and 1 deletions
|
|
@ -0,0 +1 @@
|
|||
drop table if exists settings;
|
||||
20
crates/database/migrations/20230227133744_settings.up.sql
Normal file
20
crates/database/migrations/20230227133744_settings.up.sql
Normal 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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue