Files
chatroom/database/migrations/2026_04_28_210001_create_idioms_table.php
T

42 lines
1001 B
PHP
Raw Normal View History

<?php
/**
* 文件功能:创建猜成语题库表
*
* 存储成语题目及答案,管理员可在后台增删改。
*
* @author ChatRoom Laravel
*
* @version 1.0.0
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* 创建 idioms 表。
*/
public function up(): void
{
Schema::create('idioms', function (Blueprint $table) {
$table->id();
$table->string('answer', 50)->comment('成语答案');
$table->string('hint', 255)->comment('谜语线索提示');
$table->boolean('is_active')->default(true)->comment('是否启用');
$table->unsignedSmallInteger('sort')->default(0)->comment('排序');
$table->timestamps();
});
}
/**
* 回滚迁移。
*/
public function down(): void
{
Schema::dropIfExists('idioms');
}
};