From 0e2a6cfb2da26e49243070f1ab8ce4af513f3762 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Sun, 20 Apr 2025 17:03:00 +0530 Subject: [PATCH] Removed serial_number / item_id - serial_number unique constrain and Added combined unique constraints using plant_id and item_id --- .../2025_03_23_170155_create_production_quantities_table.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/migrations/2025_03_23_170155_create_production_quantities_table.php b/database/migrations/2025_03_23_170155_create_production_quantities_table.php index 62019e9..e5db962 100644 --- a/database/migrations/2025_03_23_170155_create_production_quantities_table.php +++ b/database/migrations/2025_03_23_170155_create_production_quantities_table.php @@ -20,13 +20,13 @@ return new class extends Migration plant_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(), updated_at TIMESTAMP NOT NULL DEFAULT NOW(), deleted_at TIMESTAMP, - UNIQUE (item_id, serial_number), + UNIQUE (plant_id, serial_number), FOREIGN KEY (item_id) REFERENCES items (id), FOREIGN KEY (line_id) REFERENCES lines (id), FOREIGN KEY (shift_id) REFERENCES shifts (id),