Added combined unique constraints using plant_id and serial_number
This commit is contained in:
@@ -19,7 +19,7 @@ return new class extends Migration
|
|||||||
plant_id BIGINT NOT NULL,
|
plant_id BIGINT NOT NULL,
|
||||||
|
|
||||||
invoice_number TEXT NOT NULL,
|
invoice_number TEXT NOT NULL,
|
||||||
serial_number TEXT UNIQUE,
|
serial_number TEXT DEFAULT NULL,
|
||||||
|
|
||||||
motor_scanned_status TEXT DEFAULT NULL,
|
motor_scanned_status TEXT DEFAULT NULL,
|
||||||
pump_scanned_status TEXT DEFAULT NULL,
|
pump_scanned_status TEXT DEFAULT NULL,
|
||||||
@@ -42,6 +42,7 @@ return new class extends Migration
|
|||||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||||
deleted_at TIMESTAMP,
|
deleted_at TIMESTAMP,
|
||||||
|
|
||||||
|
UNIQUE (plant_id, serial_number),
|
||||||
FOREIGN KEY (sticker_master_id) REFERENCES sticker_masters (id),
|
FOREIGN KEY (sticker_master_id) REFERENCES sticker_masters (id),
|
||||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user