diff --git a/database/migrations/2025_03_22_184847_create_line_stops_table.php b/database/migrations/2025_03_22_184847_create_line_stops_table.php index 01e5348..ccbc3cc 100644 --- a/database/migrations/2025_03_22_184847_create_line_stops_table.php +++ b/database/migrations/2025_03_22_184847_create_line_stops_table.php @@ -19,8 +19,8 @@ return new class extends Migration block_id BIGINT NOT NULL, plant_id BIGINT NOT NULL, - code TEXT NOT NULL, - reason TEXT NOT NULL, + code CITEXT NOT NULL, + reason CITEXT NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT NOW(), updated_at TIMESTAMP NOT NULL DEFAULT NOW(), diff --git a/database/migrations/2025_03_22_190920_create_lines_table.php b/database/migrations/2025_03_22_190920_create_lines_table.php index 9a058ee..0b77ec6 100644 --- a/database/migrations/2025_03_22_190920_create_lines_table.php +++ b/database/migrations/2025_03_22_190920_create_lines_table.php @@ -18,8 +18,8 @@ return new class extends Migration block_id BIGINT NOT NULL, plant_id BIGINT NOT NULL, - name TEXT NOT NULL, - type TEXT NOT NULL, + name CITEXT NOT NULL, + type CITEXT NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT NOW(), updated_at TIMESTAMP NOT NULL DEFAULT NOW(), diff --git a/database/migrations/2025_03_23_163259_create_production_line_stops_table.php b/database/migrations/2025_03_23_163259_create_production_line_stops_table.php index efbba6e..f94a05d 100644 --- a/database/migrations/2025_03_23_163259_create_production_line_stops_table.php +++ b/database/migrations/2025_03_23_163259_create_production_line_stops_table.php @@ -19,8 +19,7 @@ return new class extends Migration block_id BIGINT NOT NULL, plant_id BIGINT NOT NULL, code_id BIGINT NOT NULL, - - reason TEXT NOT NULL, + reason_id BIGINT NOT NULL, from_datetime TIMESTAMP NOT NULL, to_datetime TIMESTAMP NOT NULL, @@ -35,7 +34,8 @@ 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 (code_id) REFERENCES line_stops (id), + FOREIGN KEY (reason_id) REFERENCES line_stops (id) ); SQL; 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 ff9a24b..f24aaaf 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 @@ -19,15 +19,16 @@ return new class extends Migration shift_id BIGINT NOT NULL, block_id BIGINT NOT NULL, plant_id BIGINT NOT NULL, + item_id BIGINT NOT NULL, - item_code TEXT NOT NULL, - serial_number TEXT NOT NULL, + serial_number CITEXT NOT NULL UNIQUE, created_at TIMESTAMP NOT NULL DEFAULT NOW(), updated_at TIMESTAMP NOT NULL DEFAULT NOW(), deleted_at TIMESTAMP, - UNIQUE (item_code, serial_number), + UNIQUE (item_id, serial_number), + FOREIGN KEY (item_id) REFERENCES items (id), FOREIGN KEY (line_id) REFERENCES lines (id), FOREIGN KEY (shift_id) REFERENCES shifts (id), FOREIGN KEY (block_id) REFERENCES blocks (id),