1
0
forked from poc/pds

Added weight_validations migration

This commit is contained in:
dhanabalan
2025-05-12 18:58:31 +05:30
parent 6f5e1f708c
commit b062239007

View File

@@ -0,0 +1,52 @@
<?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 weight_validations (
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
item_id BIGINT NOT NULL,
plant_id BIGINT NOT NULL,
obd_number TEXT NOT NULL,
line_number TEXT DEFAULT NULL,
batch_number TEXT DEFAULT NULL,
heat_number TEXT DEFAULT NULL,
obd_weight TEXT DEFAULT NULL,
vehicle_number TEXT DEFAULT NULL,
bundle_number TEXT DEFAULT NULL,
picked_weight TEXT DEFAULT NULL,
scanned_by 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('weight_validations');
}
};