aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/sql/1_create-database.up.sql
diff options
context:
space:
mode:
authormrfoxygmfr <mrfoxygmfr@sch9.ru>2025-03-17 12:58:57 +0300
committermrfoxygmfr <mrfoxygmfr@sch9.ru>2025-03-17 12:58:57 +0300
commitcad2254f0eaf770a169432296916a2acafe18b4a (patch)
treec433d43019b1988e1fa2a797439eae8381f24e9d /src/main/sql/1_create-database.up.sql
parentc89e43daf441f245fc1ae114d0723e6e42c3f52a (diff)
fix(db): remove enum dictionary tables
Diffstat (limited to 'src/main/sql/1_create-database.up.sql')
-rw-r--r--src/main/sql/1_create-database.up.sql21
1 files changed, 3 insertions, 18 deletions
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
);