hyperf-chat/migrations/2020_11_04_153347_create_em...

42 lines
1.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;
use Hyperf\DbConnection\Db;
class CreateEmoticonItemTable extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('emoticon_item', function (Blueprint $table) {
$table->unsignedInteger('id', true)->comment('表情包详情ID');
$table->unsignedInteger('emoticon_id')->default(0)->comment('表情分组ID');
$table->unsignedInteger('user_id')->default(0)->comment('用户ID0代码系统表情包');
$table->string('describe', 20)->default('')->comment('表情描述');
$table->string('url', 255)->default('')->comment('图片链接');
$table->string('file_suffix', 10)->default('')->comment('文件后缀名');
$table->unsignedBigInteger('file_size')->default(0)->comment('文件大小(单位字节)');
$table->dateTime('created_at')->nullable()->comment('创建时间');
$table->dateTime('updated_at')->nullable()->comment('更新时间');
$table->charset = 'utf8';
$table->collation = 'utf8_general_ci';
});
$prefix = config('databases.default.prefix');
DB::statement("ALTER TABLE `{$prefix}emoticon_item` comment '表情包详情表'");
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('emoticon_item');
}
}