postgres
This commit is contained in:
parent
584ffb6b11
commit
1faa3b9668
19 changed files with 1058 additions and 1244 deletions
32
migrations/0000_init.sql
Normal file
32
migrations/0000_init.sql
Normal file
|
@ -0,0 +1,32 @@
|
|||
CREATE TABLE flows (
|
||||
id UUID NOT NULL PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
"started" timestamptz NOT NULL DEFAULT current_timestamp,
|
||||
kind TEXT NOT NULL,
|
||||
input UUID[],
|
||||
ended timestamptz,
|
||||
"next" UUID,
|
||||
produced UUID[],
|
||||
FOREIGN KEY "next" REFERENCES flows(id)
|
||||
);
|
||||
|
||||
CREATE TABLE flow_notes (
|
||||
id UUID NOT NULL PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
time timestamptz NOT NULL DEFAULT current_timestamp,
|
||||
content TEXT NOT NULL,
|
||||
on_flow UUID NOT NULL,
|
||||
FOREIGN KEY on_flow REFERENCES flows(id)
|
||||
);
|
||||
|
||||
CREATE TABLE transactions (
|
||||
id UUID NOT NULL PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
created timestamptz NOT NULL DEFAULT current_timestamp,
|
||||
item TEXT NOT NULL,
|
||||
variant TEXT NOT NULL,
|
||||
price NUMERIC(2),
|
||||
origin TEXT,
|
||||
"location" TEXT,
|
||||
note TEXT,
|
||||
destination TEXT,
|
||||
consumed_price NUMERIC(2),
|
||||
consumed_timestamp timestamptz
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue