<?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
    {
        Schema::create('registration_packages', function (Blueprint $table) {
            $table->id();
            $table->foreignId('store_id')->constrained()->comment('所属门店');
            $table->string('name', 50)->comment('套餐名称，如：销售、店长');
            $table->string('description', 255)->nullable()->comment('套餐说明');
            $table->json('role_ids')->nullable()->comment('关联角色ID数组');
            $table->tinyInteger('status')->default(1)->comment('1启用 0停用');
            $table->unsignedSmallInteger('sort')->default(0)->comment('排序');
            $table->timestamps();

            $table->index('store_id');
        });
    }

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