<?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
    {
        if (!Schema::connection('mai1')->hasTable('tsispindah')) {
            Schema::connection('mai1')->create('tsispindah', function (Blueprint $table) {
                $table->id();
                $table->string('nops')->nullable(); // Nomor Pengajuan
                $table->unsignedBigInteger('idsis');
                $table->date('tgl');
                $table->string('sek'); // Sekolah tujuan
                $table->string('kelas');
                $table->text('ala'); // Alasan
                $table->string('sta')->default('menunggu');
                $table->timestamps();
            });
        }
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::connection('mai1')->dropIfExists('tsispindah');
    }
};
