Merge branch 'master' of ssh://172.31.31.31:2222/poc/pds

This commit is contained in:
dhanabalan
2025-03-25 16:54:21 +05:30
8 changed files with 86 additions and 87 deletions

View File

@@ -14,9 +14,9 @@ return new class extends Migration
CREATE TABLE plants (
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
code INT NOT NULL CHECK (code >= 1000) UNIQUE,
company_id BIGINT NOT NULL,
code INT NOT NULL CHECK (code >= 1000) UNIQUE,
name TEXT NOT NULL UNIQUE, -- CITEXT use extension
address TEXT NOT NULL,

View File

@@ -14,8 +14,8 @@ return new class extends Migration
CREATE TABLE blocks (
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
name TEXT NOT NULL,
plant_id BIGINT NOT NULL,
name TEXT NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),

View File

@@ -18,8 +18,7 @@ return new class extends Migration
shift_id BIGINT NOT NULL,
block_id BIGINT NOT NULL,
plant_id BIGINT NOT NULL,
code_id BIGINT NOT NULL,
reason_id BIGINT NOT NULL,
lineStop_id BIGINT NOT NULL,
from_datetime TIMESTAMP NOT NULL,
to_datetime TIMESTAMP NOT NULL,
@@ -34,8 +33,7 @@ return new class extends Migration
FOREIGN KEY (shift_id) REFERENCES shifts (id),
FOREIGN KEY (block_id) REFERENCES blocks (id),
FOREIGN KEY (plant_id) REFERENCES plants (id),
FOREIGN KEY (code_id) REFERENCES line_stops (id),
FOREIGN KEY (reason_id) REFERENCES line_stops (id)
FOREIGN KEY (lineStop_id) REFERENCES line_stops (id)
);
SQL;