Initial version

This commit is contained in:
Jani Pulkkinen
2025-04-16 15:03:30 +03:00
commit 27a51916a3
24 changed files with 2551 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
-- This file should undo anything in `up.sql`
drop table loota_customer;
drop table loota_order;
drop table loota_box;

View 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;