Added foreign key for plant_id and item_characteristics_id for table sticker structure details table
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled

This commit is contained in:
dhanabalan
2025-12-23 11:19:31 +05:30
parent 0fa69f3398
commit 530078a4d8

View File

@@ -0,0 +1,42 @@
<?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
{
$sql1 = <<<'SQL'
ALTER TABLE sticker_structure_details
ADD COLUMN plant_id BIGINT NOT NULL,
ADD CONSTRAINT sticker_structure_details_plant_id_fkey
FOREIGN KEY (plant_id) REFERENCES plants(id);
SQL;
DB::statement($sql1);
$sql2 = <<<'SQL'
ALTER TABLE sticker_structure_details
ADD COLUMN item_characteristic_id BIGINT NULL,
ADD CONSTRAINT sticker_structure_details_item_characteristic_id_fkey
FOREIGN KEY (item_characteristic_id) REFERENCES item_characteristics(id);
SQL;
DB::statement($sql2);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
// Schema::table('sticker_structure_details', function (Blueprint $table) {
// //
// });
}
};