<?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('tg_comm', function (Blueprint $table) {
            $table->increments('id'); // PRIMARY KEY + AUTO_INCREMENT
            $table->string('command')->nullable()->comment('指令名称');
            $table->string('instructions')->nullable()->comment('指令用途');
            $table->string('action', )->nullable()->comment('对应动作指令');
            $table->longText('memo')->nullable()->comment('使用说明');
            $table->integer('display')->default(1)->comment('指令列表 0不显示 1显示');
            $table->integer('manager')->default(0)->comment('管理权限0需要1不需要');
            $table->integer('valid')->default(1)->comment('0停用1启用');
            $table->dateTime('created_at')->useCurrent()->nullable();
            $table->dateTime('updated_at')->nullable()->useCurrentOnUpdate();
            // 可选：你也可以在这里设置表的注释
            $table->comment('机器人指令');
            // 指定表的 charset 与 collation
            $table->charset = 'utf8mb4';
            $table->collation = 'utf8mb4_0900_ai_ci';
        });
    }

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