<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        if (Schema::hasTable('mathchapters')) {
            return;
        }

        Schema::create('mathchapters', function (Blueprint $table) {
            $table->id();
            $table->string('chaptername', 250);
            $table->string('chapterslug', 250)->nullable();
            $table->integer('chapterorder')->nullable();
            $table->unsignedBigInteger('classgroupid')->nullable();
            $table->string('classgroupname', 250)->nullable();
            $table->integer('status')->default(1);
            $table->integer('createdby')->nullable();
            $table->dateTime('createdtime')->nullable();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('mathchapters');
    }
};
