hyperf-chat/migrations/2020_11_04_153347_create_em...

42 lines
1.5 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
class CreateEmoticonItemTable extends Migration
2020-11-04 16:47:17 +08:00
{
/**
* Run the migrations.
*/
public function up(): void
{
2021-07-05 21:52:44 +08:00
Schema::create('emoticon_item', function (Blueprint $table) {
$table->unsignedInteger('id', true)->comment('表情包详情ID');
2020-11-04 16:47:17 +08:00
$table->unsignedInteger('emoticon_id')->default(0)->comment('表情分组ID');
$table->unsignedInteger('user_id')->default(0)->comment('用户ID0代码系统表情包');
2021-07-05 21:52:44 +08:00
$table->string('describe', 20)->default('')->comment('表情描述');
$table->string('url', 255)->default('')->comment('图片链接');
2020-11-04 16:47:17 +08:00
$table->string('file_suffix', 10)->default('')->comment('文件后缀名');
$table->unsignedBigInteger('file_size')->default(0)->comment('文件大小(单位字节)');
2021-07-05 21:52:44 +08:00
$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');
2021-07-05 21:52:44 +08:00
DB::statement("ALTER TABLE `{$prefix}emoticon_item` comment '表情包详情表'");
2020-11-04 16:47:17 +08:00
}
/**
* Reverse the migrations.
*/
public function down(): void
{
2021-07-05 21:52:44 +08:00
Schema::dropIfExists('emoticon_item');
2020-11-04 16:47:17 +08:00
}
}