2021-03-25 17:32:36 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Hyperf\Database\Schema\Schema;
|
|
|
|
use Hyperf\Database\Schema\Blueprint;
|
|
|
|
use Hyperf\Database\Migrations\Migration;
|
|
|
|
|
|
|
|
class CreateGroupMemberTable extends Migration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*/
|
|
|
|
public function up(): void
|
|
|
|
{
|
|
|
|
Schema::create('group_member', function (Blueprint $table) {
|
|
|
|
$table->unsignedInteger('id', true)->comment('群成员ID');
|
|
|
|
$table->unsignedInteger('group_id')->default(0)->comment('群ID');
|
|
|
|
$table->unsignedInteger('user_id')->default(0)->comment('用户ID');
|
|
|
|
$table->tinyInteger('leader')->comment('成员属性[0:普通成员;1:管理员;2:群主;]');
|
|
|
|
$table->tinyInteger('is_mute')->default(0)->comment('是否禁言[0:否;1:是;]');
|
|
|
|
$table->tinyInteger('is_quit')->default(0)->comment('是否退群[0:否;1:是;]');
|
|
|
|
$table->string('user_card', 20)->default('')->comment('群名片');
|
|
|
|
$table->dateTime('created_at')->nullable()->comment('入群时间');
|
2022-01-23 15:13:58 +08:00
|
|
|
$table->dateTime('updated_at')->nullable()->comment('更新时间');
|
2021-03-25 17:32:36 +08:00
|
|
|
$table->dateTime('deleted_at')->nullable()->comment('退群时间');
|
|
|
|
|
2021-07-08 19:09:06 +08:00
|
|
|
$table->charset = 'utf8';
|
2021-03-25 17:32:36 +08:00
|
|
|
$table->collation = 'utf8_general_ci';
|
2021-07-08 19:09:06 +08:00
|
|
|
$table->engine = 'InnoDB';
|
2021-03-25 17:32:36 +08:00
|
|
|
|
|
|
|
$table->unique(['group_id', 'user_id'], 'uk_group_id_user_id');
|
2021-07-08 19:09:06 +08:00
|
|
|
$table->index(['user_id'], 'idx_user_id');
|
2021-08-27 23:50:40 +08:00
|
|
|
$table->comment('聊天群组成员表');
|
2021-03-25 17:32:36 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*/
|
|
|
|
public function down(): void
|
|
|
|
{
|
|
|
|
Schema::dropIfExists('group_member');
|
|
|
|
}
|
|
|
|
}
|