From cad2254f0eaf770a169432296916a2acafe18b4a Mon Sep 17 00:00:00 2001 From: mrfoxygmfr Date: Mon, 17 Mar 2025 12:58:57 +0300 Subject: fix(db): remove enum dictionary tables --- src/main/sql/1_create-database.up.sql | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'src/main/sql/1_create-database.up.sql') diff --git a/src/main/sql/1_create-database.up.sql b/src/main/sql/1_create-database.up.sql index d4566fc..c1a63f4 100644 --- a/src/main/sql/1_create-database.up.sql +++ b/src/main/sql/1_create-database.up.sql @@ -1,11 +1,6 @@ -CREATE TABLE product_types( - id INTEGER PRIMARY KEY, - name TEXT NOT NULL -); - CREATE TABLE products( id INTEGER PRIMARY KEY, - type_id INTEGER NOT NULL REFERENCES product_types(id), + type TEXT NOT NULL, height INTEGER NOT NULL, width INTEGER NOT NULL, depth INTEGER NOT NULL, @@ -40,33 +35,23 @@ CREATE TABLE storage_slots( depth INTEGER NOT NULL ); -CREATE TABLE product_storage_statues( - id INTEGER PRIMARY KEY, - name TEXT NOT NULL -); - CREATE TABLE product_slots( id INTEGER PRIMARY KEY, product_id INTEGER NOT NULL REFERENCES products(id), slot_id INTEGER NOT NULL REFERENCES storage_slots(id), amount INTEGER NOT NULL CHECK (amount > 0), - status_id INTEGER NOT NULL REFERENCES product_storage_statues(id), + status TEXT NOT NULL, placement_time TIMESTAMP NOT NULL ); CREATE TYPE OPERATION_TYPE AS ENUM('SUPPLY', 'ISSUE'); -CREATE TABLE operation_statues( - id INTEGER PRIMARY KEY, - name TEXT NOT NULL -); - CREATE TABLE operations( id INTEGER PRIMARY KEY, partner_id INTEGER NOT NULL REFERENCES partners(id), responsible_id INTEGER NOT NULL REFERENCES partner_contacts(id), type OPERATION_TYPE NOT NULL, - status_id INTEGER NOT NULL REFERENCES operation_statues(id), + status TEXT NOT NULL, date_created TIMESTAMP NOT NULL, date_finished TIMESTAMP NULL ); -- cgit mrf-deployment