hyperf-chat/migrations/2020_11_04_153605_create_co...

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;
2021-07-08 19:09:06 +08:00
2022-01-21 22:19:42 +08:00
class CreateContactApplyTable extends Migration
2020-11-04 16:47:17 +08:00
{
/**
* Run the migrations.
*/
public function up(): void
{
2022-01-21 22:19:42 +08:00
Schema::create('contact_apply', function (Blueprint $table) {
2020-11-04 16:47:17 +08:00
$table->unsignedInteger('id', true)->comment('申请ID');
$table->unsignedInteger('user_id')->default(0)->comment('申请人ID');
2021-07-08 19:09:06 +08:00
$table->unsignedInteger('friend_id')->default(0)->comment('好友ID');
$table->string('remark', 50)->default('')->comment('备注信息');
2020-11-04 16:47:17 +08:00
$table->dateTime('created_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(['user_id'], 'idx_user_id');
$table->index(['friend_id'], 'idx_friend_id');
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
{
2022-01-21 22:19:42 +08:00
Schema::dropIfExists('contact_apply');
2020-11-04 16:47:17 +08:00
}
}