This commit is contained in:
2026-02-18 19:41:03 +08:00
parent a0c2350662
commit 6543e2ccdd
18 changed files with 4885 additions and 1196 deletions

View File

@@ -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');
}
};