更新
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
// 系统通知表
|
||||
Schema::create('system_notifications', function (Blueprint $table) {
|
||||
$table->comment('系统通知表');
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('user_id')->comment('用户ID');
|
||||
$table->string('title')->comment('通知标题');
|
||||
$table->text('content')->comment('通知内容');
|
||||
$table->string('type')->default('info')->comment('通知类型:info, success, warning, error, task, system');
|
||||
$table->string('category')->nullable()->comment('通知分类:system, task, message, reminder, announcement');
|
||||
$table->json('data')->nullable()->comment('附加数据(JSON格式)');
|
||||
$table->string('action_type')->nullable()->comment('操作类型:link, modal, none');
|
||||
$table->text('action_data')->nullable()->comment('操作数据');
|
||||
$table->boolean('is_read')->default(false)->comment('是否已读');
|
||||
$table->timestamp('read_at')->nullable()->comment('阅读时间');
|
||||
$table->boolean('sent_via_websocket')->default(false)->comment('是否已通过WebSocket发送');
|
||||
$table->timestamp('sent_at')->nullable()->comment('发送时间');
|
||||
$table->integer('retry_count')->default(0)->comment('重试次数');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index('user_id');
|
||||
$table->index('is_read');
|
||||
$table->index('type');
|
||||
$table->index('category');
|
||||
$table->index('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('system_notifications');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user