Initial version
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
drop table loota_customer;
|
||||
drop table loota_order;
|
||||
drop table loota_box;
|
||||
34
migrations/2025-04-10-064257_create_lootakalenteri/up.sql
Normal file
34
migrations/2025-04-10-064257_create_lootakalenteri/up.sql
Normal file
@@ -0,0 +1,34 @@
|
||||
-- Lootakalenteri migration tables
|
||||
create table loota_customer
|
||||
(
|
||||
id uuid primary key not null default gen_random_uuid(),
|
||||
identifier varchar not null,
|
||||
created_time timestamp with time zone not null default now()
|
||||
);
|
||||
|
||||
create table loota_order
|
||||
(
|
||||
id uuid primary key not null default gen_random_uuid(),
|
||||
customer_id uuid not null,
|
||||
location varchar not null,
|
||||
created_time timestamp with time zone not null default now()
|
||||
);
|
||||
|
||||
alter table loota_order
|
||||
add constraint fk_customer_id foreign key (customer_id)
|
||||
references loota_customer (id) on delete cascade;
|
||||
|
||||
|
||||
|
||||
create table loota_box
|
||||
(
|
||||
id uuid primary key not null default gen_random_uuid(),
|
||||
order_id uuid not null,
|
||||
delivery_date timestamp with time zone,
|
||||
pickup_date timestamp with time zone,
|
||||
created_time timestamp with time zone not null default now()
|
||||
);
|
||||
|
||||
alter table loota_box
|
||||
add constraint fk_order_id foreign key (order_id)
|
||||
references loota_order (id) on delete cascade;
|
||||
Reference in New Issue
Block a user