// database/migrations/xxxx_fix_kelas_autoincrement.php
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    public function up(): void
    {
        // Hapus kolom sisa refactor kalau masih ada
        if (Schema::hasColumn('kelas', 'id_kelas_old')) {
            Schema::table('kelas', function ($table) {
                $table->dropColumn('id_kelas_old');
            });
        }

        // Reset AUTO_INCREMENT ke angka setelah max id_kelas yang ada
        DB::statement('ALTER TABLE kelas AUTO_INCREMENT = 1');
    }

    public function down(): void {}
};