50 lines
1.6 KiB
PHP
50 lines
1.6 KiB
PHP
<?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
|
|
{
|
|
Schema::create('master_komoditas', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('nama');
|
|
|
|
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
|
|
$table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
|
|
$table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
|
|
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
});
|
|
|
|
Schema::create('master_varietas', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('komoditas_id')->constrained('master_komoditas')->onDelete('cascade');
|
|
$table->string('nama');
|
|
$table->text('deskripsi')->unique();
|
|
|
|
$table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null');
|
|
$table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null');
|
|
$table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null');
|
|
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('master_komoditas');
|
|
Schema::dropIfExists('master_varietas');
|
|
}
|
|
};
|