MIF_E31210592/database/migrations/2024_03_12_0000012_materi.php

36 lines
896 B
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('materi', function (Blueprint $table) {
$table->bigIncrements('id_materi');
$table->string('judul_materi', 100)->nullable(false);
$table->string('lampiran_materi', 100)->nullable();
$table->text('keterangan')->nullable();
$table->unsignedBigInteger('id_mapel');
$table->timestamps();
$table->foreign('id_mapel')->references('id_mapel')->on('mata_pelajaran')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('materi');
}
};