| 1234567891011121314151617181920212223242526272829303132 |
- <?php
- use Illuminate\Database\Migrations\Migration;
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Support\Facades\Schema;
- return new class extends Migration
- {
- public function up(): void
- {
- Schema::create('user_notifications', function (Blueprint $table) {
- $table->id();
- $table->foreignId('user_id')->constrained()->cascadeOnDelete();
- $table->string('type'); // platform | reclamation | schedule
- $table->string('event'); // created | status_changed | schedule_added
- $table->string('title');
- $table->text('message');
- $table->text('message_html')->nullable();
- $table->json('data')->nullable();
- $table->timestamp('read_at')->nullable();
- $table->timestamps();
- $table->index(['user_id', 'read_at']);
- $table->index(['type', 'event']);
- });
- }
- public function down(): void
- {
- Schema::dropIfExists('user_notifications');
- }
- };
|