Refactor store: use migrations and split logic
This commit is contained in:
parent
376edd7267
commit
922710a2cd
6 changed files with 250 additions and 212 deletions
26
internal/store/migrations/1.sql
Normal file
26
internal/store/migrations/1.sql
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
create table cake (
|
||||
id integer primary key autoincrement,
|
||||
name text not null unique,
|
||||
price integer not null
|
||||
);
|
||||
|
||||
create table customer_order (
|
||||
id integer primary key autoincrement,
|
||||
name text,
|
||||
surname text,
|
||||
phone text,
|
||||
location text,
|
||||
order_date string not null,
|
||||
delivery_date string not null,
|
||||
status text,
|
||||
paid integer
|
||||
);
|
||||
|
||||
create table ordered_cake (
|
||||
customer_order integer references customer_order (id) not null,
|
||||
cake integer references cake (id) not null,
|
||||
amount integer not null,
|
||||
primary key (customer_order, cake)
|
||||
);
|
||||
|
||||
PRAGMA user_version = 1;
|
||||
Loading…
Add table
Add a link
Reference in a new issue