1
0
forked from poc/pds

Removed serial_number / item_id - serial_number unique constrain and Added combined unique constraints using plant_id and item_id

This commit is contained in:
dhanabalan
2025-04-20 17:03:00 +05:30
parent 3d50c67c6d
commit 0e2a6cfb2d

View File

@@ -20,13 +20,13 @@ return new class extends Migration
plant_id BIGINT NOT NULL, plant_id BIGINT NOT NULL,
item_id BIGINT NOT NULL, item_id BIGINT NOT NULL,
serial_number TEXT NOT NULL UNIQUE, serial_number TEXT NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(), created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW(), updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
deleted_at TIMESTAMP, deleted_at TIMESTAMP,
UNIQUE (item_id, serial_number), UNIQUE (plant_id, serial_number),
FOREIGN KEY (item_id) REFERENCES items (id), FOREIGN KEY (item_id) REFERENCES items (id),
FOREIGN KEY (line_id) REFERENCES lines (id), FOREIGN KEY (line_id) REFERENCES lines (id),
FOREIGN KEY (shift_id) REFERENCES shifts (id), FOREIGN KEY (shift_id) REFERENCES shifts (id),