hyperf-chat/migrations/2020_11_04_153337_create_em...

39 lines
1.2 KiB
PHP
Raw Normal View History

2020-11-04 16:47:17 +08:00
<?php
use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;
use Hyperf\DbConnection\Db;
2021-07-05 21:52:44 +08:00
2020-11-04 16:47:17 +08:00
class CreateEmoticonTable extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('emoticon', function (Blueprint $table) {
$table->unsignedInteger('id', true)->comment('表情分组ID');
2021-07-05 21:52:44 +08:00
$table->string('name', 50)->default('')->nullable(false)->comment('分组名称');
$table->string('icon', 255)->default('')->comment('分组图标');
$table->unsignedTinyInteger('status')->default(0)->comment('分组状态[-1:已删除;0:正常;1:已禁用;]');
$table->dateTime('created_at')->nullable()->comment('创建时间');
$table->dateTime('updated_at')->nullable()->comment('更新时间');
2020-11-04 16:47:17 +08:00
2021-07-05 21:52:44 +08:00
$table->charset = 'utf8';
2020-11-04 16:47:17 +08:00
$table->collation = 'utf8_general_ci';
});
$prefix = config('databases.default.prefix');
DB::statement("ALTER TABLE `{$prefix}emoticon` comment '表情包'");
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('emoticon');
}
}