hyperf-chat/migrations/2020_11_04_153636_create_gr...

45 lines
1.8 KiB
PHP
Raw Permalink 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;
class CreateGroupNoticeTable extends Migration
2020-11-04 16:47:17 +08:00
{
/**
* Run the migrations.
*/
public function up(): void
{
2021-04-10 13:55:21 +08:00
Schema::create('group_notice', function (Blueprint $table) {
$table->unsignedInteger('id', true)->comment('群公告ID');
$table->unsignedInteger('group_id')->default(0)->comment('群组ID');
$table->unsignedInteger('creator_id')->default(0)->comment('创建者用户ID');
$table->string('title', 50)->default('')->charset('utf8mb4')->comment('公告标题');
2020-11-04 16:47:17 +08:00
$table->text('content')->charset('utf8mb4')->comment('公告内容');
$table->tinyInteger('is_top')->default(0)->comment('是否置顶[0:否;1:是;]');
$table->tinyInteger('is_delete')->default(0)->comment('是否删除[0:否;1:是;]');
$table->tinyInteger('is_confirm')->default(0)->comment('是否需群成员确认公告[0:否;1:是;]');
$table->json('confirm_users')->nullable()->comment('已确认成员');
2020-11-04 16:47:17 +08:00
$table->dateTime('created_at')->nullable()->comment('创建时间');
$table->dateTime('updated_at')->nullable()->comment('更新时间');
$table->dateTime('deleted_at')->nullable()->comment('删除时间');
2021-07-08 19:09:06 +08:00
$table->charset = 'utf8';
2020-11-04 16:47:17 +08:00
$table->collation = 'utf8_general_ci';
2021-07-08 19:09:06 +08:00
$table->engine = 'InnoDB';
2020-11-04 16:47:17 +08:00
$table->index(['group_id', 'is_delete', 'is_top', 'updated_at'], 'idx_group_id_is_delete_is_top_updated_at');
2021-08-27 23:50:40 +08:00
$table->comment('群组公告表');
2020-11-04 16:47:17 +08:00
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('group_notice');
2020-11-04 16:47:17 +08:00
}
}