From dd941eb5d594eef99e921151fb9fbb4793757229 Mon Sep 17 00:00:00 2001 From: mrfoxygmfr Date: Sun, 23 Mar 2025 15:15:06 +0300 Subject: fix(db): fix auto increment for ids --- src/main/sql/1_create-database.up.sql | 14 +++++++------- 1 file changed, 7 insertions(+), 7 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 c9179de..a081e0e 100644 --- a/src/main/sql/1_create-database.up.sql +++ b/src/main/sql/1_create-database.up.sql @@ -1,5 +1,5 @@ CREATE TABLE products( - id INTEGER PRIMARY KEY, + id SERIAL PRIMARY KEY, name TEXT NOT NULL, type TEXT NOT NULL, height INTEGER NOT NULL, @@ -11,7 +11,7 @@ CREATE TABLE products( CREATE TYPE PARTNER_TYPE AS ENUM('SUPPLIER', 'ISSUER'); CREATE TABLE partners( - id INTEGER PRIMARY KEY, + id SERIAL PRIMARY KEY, name TEXT NOT NULL, tax_number TEXT NOT NULL, type PARTNER_TYPE NOT NULL, @@ -19,7 +19,7 @@ CREATE TABLE partners( ); CREATE TABLE partner_contacts( - id INTEGER PRIMARY KEY, + id SERIAL PRIMARY KEY, partner_id INTEGER NOT NULL REFERENCES partners(id), surname TEXT NOT NULL, name TEXT NOT NULL, @@ -29,7 +29,7 @@ CREATE TABLE partner_contacts( ); CREATE TABLE storage_slots( - id INTEGER PRIMARY KEY, + id SERIAL PRIMARY KEY, location TEXT NOT NULL, height INTEGER NOT NULL, width INTEGER NOT NULL, @@ -37,7 +37,7 @@ CREATE TABLE storage_slots( ); CREATE TABLE product_slots( - id INTEGER PRIMARY KEY, + id SERIAL 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), @@ -48,7 +48,7 @@ CREATE TABLE product_slots( CREATE TYPE OPERATION_TYPE AS ENUM('SUPPLY', 'ISSUE'); CREATE TABLE operations( - id INTEGER PRIMARY KEY, + id SERIAL PRIMARY KEY, partner_id INTEGER NOT NULL REFERENCES partners(id), responsible_id INTEGER NOT NULL REFERENCES partner_contacts(id), type OPERATION_TYPE NOT NULL, @@ -58,7 +58,7 @@ CREATE TABLE operations( ); CREATE TABLE operation_products( - id INTEGER PRIMARY KEY, + id SERIAL PRIMARY KEY, operation_id INTEGER NOT NULL REFERENCES operations(id), product_id INTEGER NOT NULL REFERENCES products(id), amount INTEGER NOT NULL CHECK (amount > 0) -- cgit mrf-deployment