perf: 代码整理

This commit is contained in:
weifashi
2023-12-29 11:45:42 +08:00
parent ab0539a263
commit f76d36a74b
6 changed files with 137 additions and 158 deletions
@@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddWebSocketDialogsTop extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('web_socket_dialog_msgs', function (Blueprint $table) {
if (Schema::hasColumn('web_socket_dialog_msgs', 'top')) {
$table->dropColumn("top");
$table->dropColumn("top_at");
}
});
//
Schema::table('web_socket_dialogs', function (Blueprint $table) {
$table->bigInteger('top_msg_id')->nullable()->default(0)->after('link_id')->comment('置顶的消息ID');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('web_socket_dialog_msgs', function (Blueprint $table) {
if (!Schema::hasColumn('web_socket_dialog_msgs', 'top')) {
$table->bigInteger('top')->nullable()->default(0)->after('send')->comment('置顶的会员ID');
$table->timestamp('top_at')->nullable()->after('top')->comment('置顶时间');
}
});
//
Schema::table('web_socket_dialogs', function (Blueprint $table) {
$table->dropColumn("top_msg_id");
});
}
}