cdb/migrations/0000_init.sql
JMARyA 581361dde6
Some checks are pending
ci/woodpecker/push/build Pipeline is pending
update
2025-06-07 21:30:01 +02:00

32 lines
919 B
SQL

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 DOUBLE PRECISION,
origin TEXT,
"location" TEXT,
note TEXT,
destination TEXT,
consumed_price DOUBLE PRECISION,
consumed_timestamp timestamptz
);