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:
@@ -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),
|
||||||
|
|||||||
Reference in New Issue
Block a user