1
0
forked from poc/pds

Import Fun Completed and Sticker Master

This commit is contained in:
dhanabalan
2025-03-28 16:52:40 +05:30
parent ef4504155a
commit e46f290fd1
47 changed files with 1317 additions and 335 deletions

View File

@@ -14,8 +14,6 @@ return new class extends Migration
CREATE TABLE lines (
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
shift_id BIGINT NOT NULL,
block_id BIGINT NOT NULL,
plant_id BIGINT NOT NULL,
name TEXT NOT NULL,
@@ -25,9 +23,7 @@ return new class extends Migration
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
deleted_at TIMESTAMP,
UNIQUE (name, shift_id, block_id, plant_id),
FOREIGN KEY (shift_id) REFERENCES shifts (id),
FOREIGN KEY (block_id) REFERENCES blocks (id),
UNIQUE (name, plant_id),
FOREIGN KEY (plant_id) REFERENCES plants (id)
);
SQL;

View File

@@ -14,8 +14,6 @@ return new class extends Migration
CREATE TABLE items (
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
line_id BIGINT NOT NULL,
block_id BIGINT NOT NULL,
plant_id BIGINT NOT NULL,
code TEXT NOT NULL CHECK (LENGTH(code) >= 6),
@@ -27,9 +25,7 @@ return new class extends Migration
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
deleted_at TIMESTAMP,
UNIQUE (code, line_id, block_id, plant_id),
FOREIGN KEY (line_id) REFERENCES lines (id),
FOREIGN KEY (block_id) REFERENCES blocks (id),
UNIQUE (code, plant_id),
FOREIGN KEY (plant_id) REFERENCES plants (id)
);
SQL;

View File

@@ -15,21 +15,12 @@ return new class extends Migration
CREATE TABLE line_stops (
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
shift_id BIGINT NOT NULL,
block_id BIGINT NOT NULL,
plant_id BIGINT NOT NULL,
code TEXT NOT NULL,
code TEXT NOT NULL UNIQUE,
reason TEXT NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
deleted_at TIMESTAMP,
UNIQUE (code, shift_id, block_id, plant_id),
FOREIGN KEY (shift_id) REFERENCES shifts (id),
FOREIGN KEY (block_id) REFERENCES blocks (id),
FOREIGN KEY (plant_id) REFERENCES plants (id)
deleted_at TIMESTAMP
);
SQL;

View File

@@ -16,9 +16,8 @@ return new class extends Migration
line_id BIGINT NOT NULL,
shift_id BIGINT NOT NULL,
block_id BIGINT NOT NULL,
plant_id BIGINT NOT NULL,
lineStop_id BIGINT NOT NULL,
linestop_id BIGINT NOT NULL,
from_datetime TIMESTAMP NOT NULL,
to_datetime TIMESTAMP NOT NULL,
@@ -31,9 +30,8 @@ return new class extends Migration
FOREIGN KEY (line_id) REFERENCES lines (id),
FOREIGN KEY (shift_id) REFERENCES shifts (id),
FOREIGN KEY (block_id) REFERENCES blocks (id),
FOREIGN KEY (plant_id) REFERENCES plants (id),
FOREIGN KEY (lineStop_id) REFERENCES line_stops (id)
FOREIGN KEY (linestop_id) REFERENCES line_stops (id)
);
SQL;

View File

@@ -17,7 +17,6 @@ return new class extends Migration
line_id BIGINT NOT NULL,
shift_id BIGINT NOT NULL,
block_id BIGINT NOT NULL,
plant_id BIGINT NOT NULL,
item_id BIGINT NOT NULL,
@@ -31,7 +30,6 @@ return new class extends Migration
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),
FOREIGN KEY (plant_id) REFERENCES plants (id)
);
SQL;

View File

@@ -0,0 +1,62 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$sql = <<<'SQL'
CREATE TABLE sticker_masters (
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
item_id BIGINT NOT NULL,
plant_id BIGINT NOT NULL,
serial_number_motor TEXT DEFAULT NULL,
serial_number_pump TEXT DEFAULT NULL,
serial_number_pumpset TEXT DEFAULT NULL,
pack_slip_motor TEXT DEFAULT NULL,
pack_slip_pump TEXT DEFAULT NULL,
pack_slip_pumpset TEXT DEFAULT NULL,
name_plate_motor TEXT DEFAULT NULL,
name_plate_pump TEXT DEFAULT NULL,
name_plate_pumpset TEXT DEFAULT NULL,
tube_sticker_motor TEXT DEFAULT NULL,
tube_sticker_pump TEXT DEFAULT NULL,
tube_sticker_pumpset TEXT DEFAULT NULL,
warranty_card TEXT DEFAULT NULL,
part_validation1 TEXT DEFAULT NULL,
part_validation2 TEXT DEFAULT NULL,
part_validation3 TEXT DEFAULT NULL,
part_validation4 TEXT DEFAULT NULL,
part_validation5 TEXT DEFAULT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
deleted_at TIMESTAMP,
FOREIGN KEY (item_id) REFERENCES items (id),
FOREIGN KEY (plant_id) REFERENCES plants (id)
);
SQL;
DB::statement($sql);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('sticker_masters');
}
};

View File

@@ -0,0 +1,67 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$sql = <<<'SQL'
CREATE TABLE quality_validations (
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
item_id BIGINT NOT NULL,
plant_id BIGINT NOT NULL,
stickermaster_id BIGINT NOT NULL,
production_order TEXT NOT NULL,
serial_number_motor TEXT DEFAULT NULL,
serial_number_pump TEXT DEFAULT NULL,
serial_number_pumpset TEXT DEFAULT NULL,
pack_slip_motor TEXT DEFAULT NULL,
pack_slip_pump TEXT DEFAULT NULL,
pack_slip_pumpset TEXT DEFAULT NULL,
name_plate_motor TEXT DEFAULT NULL,
name_plate_pump TEXT DEFAULT NULL,
name_plate_pumpset TEXT DEFAULT NULL,
tube_sticker_motor TEXT DEFAULT NULL,
tube_sticker_pump TEXT DEFAULT NULL,
tube_sticker_pumpset TEXT DEFAULT NULL,
warranty_card TEXT DEFAULT NULL,
part_validation1 TEXT DEFAULT NULL,
part_validation2 TEXT DEFAULT NULL,
part_validation3 TEXT DEFAULT NULL,
part_validation4 TEXT DEFAULT NULL,
part_validation5 TEXT DEFAULT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
deleted_at TIMESTAMP,
FOREIGN KEY (item_id) REFERENCES items (id),
FOREIGN KEY (plant_id) REFERENCES plants (id),
FOREIGN KEY (stickerMaster_id) REFERENCES sticker_masters (id)
);
SQL;
DB::statement($sql);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('quality_validations');
}
};