42 lines
1001 B
PHP
42 lines
1001 B
PHP
|
|
<?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');
|
||
|
|
}
|
||
|
|
};
|