<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\Enums\ModuleType;

return new class extends Migration {
  /**
   * Run the migrations.
   */
  public function up(): void
  {
    Schema::create('code_configs', function (Blueprint $table) {
      $table->id();
      $table->string('module')->default(ModuleType::Budget)->unique()->index();
      $table->string('prefix');
      $table->string('separator')->default('/');
      $table->integer('digits')->default(4);
      $table->integer('last_number')->default(0);
      $table->boolean('is_user_alias')->default(false);
      $table->timestamps();
    });
  }

  /**
   * Reverse the migrations.
   */
  public function down(): void
  {
    Schema::dropIfExists('code_configs');
  }
};
