diff options
Diffstat (limited to 'src/main/sql')
-rw-r--r-- | src/main/sql/1_create-database.down.sql | 5 | ||||
-rw-r--r-- | src/main/sql/1_create-database.up.sql | 21 |
2 files changed, 4 insertions, 22 deletions
diff --git a/src/main/sql/1_create-database.down.sql b/src/main/sql/1_create-database.down.sql index f43aba0..bc28179 100644 --- a/src/main/sql/1_create-database.down.sql +++ b/src/main/sql/1_create-database.down.sql @@ -1,12 +1,9 @@ DROP TABLE IF EXISTS operation_products; DROP TABLE IF EXISTS operations; -DROP TABLE IF EXISTS operation_statuses; DROP TYPE IF EXISTS OPERATION_TYPE; DROP TABLE IF EXISTS product_slots; -DROP TABLE IF EXISTS product_storage_statues; DROP TABLE IF EXISTS storage_slots; DROP TABLE IF EXISTS partner_contacts; DROP TABLE IF EXISTS partners; DROP TYPE IF EXISTS PARTNER_TYPE; -DROP TABLE IF EXISTS products; -DROP TABLE IF EXISTS product_types;
\ No newline at end of file +DROP TABLE IF EXISTS products;
\ No newline at end of file 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 ); |