Files
database-kesiswaan/database/migrations/2026_04_09_203934_create_classes_table.php
2026-04-12 06:24:30 +00:00

37 lines
1.0 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('classes', function (Blueprint $table) {
$table->id();
$table->foreignId('academic_year_id')->constrained()->cascadeOnUpdate()->restrictOnDelete();
$table->foreignId('department_id')->constrained()->cascadeOnUpdate()->restrictOnDelete();
$table->string('name', 100);
$table->string('level', 10);
$table->string('homeroom_teacher', 100)->nullable();
$table->unsignedInteger('capacity')->nullable();
$table->boolean('is_active')->default(true);
$table->timestamps();
$table->unique(['academic_year_id', 'name']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('classes');
}
};