Added model masters migration file
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
// Schema::create('model_masters', function (Blueprint $table) {
|
||||
// $table->id();
|
||||
// $table->timestamps();
|
||||
// });
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE model_masters (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
machine_id BIGINT NOT NULL,
|
||||
heading_name TEXT DEFAULT NULL,
|
||||
heading_value TEXT DEFAULT NULL,
|
||||
type_name TEXT DEFAULT NULL,
|
||||
type_value TEXT DEFAULT NULL,
|
||||
has_motor TEXT DEFAULT '0',
|
||||
has_m_part TEXT DEFAULT '0',
|
||||
has_m_count TEXT DEFAULT '0',
|
||||
has_pump TEXT DEFAULT '0',
|
||||
has_p_part TEXT DEFAULT '0',
|
||||
has_p_count TEXT DEFAULT '0',
|
||||
has_name_plate TEXT DEFAULT '0',
|
||||
has_np_part TEXT DEFAULT '0',
|
||||
has_np_count TEXT DEFAULT '0',
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (plant_id, machine_id, heading_name, heading_value, type_name, type_value),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (machine_id) REFERENCES machines (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('model_masters');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user