38 lines
1.0 KiB
PHP
38 lines
1.0 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*/
|
|
public function up(): void
|
|
{
|
|
Schema::create('notifiers', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
|
$table->string('type'); // 'discord' | 'webhook'
|
|
$table->string('name');
|
|
$table->string('url', 2048);
|
|
$table->string('scope')->default('all'); // 'all' | 'feeds'
|
|
$table->boolean('enabled')->default(true);
|
|
$table->timestamp('last_triggered_at')->nullable();
|
|
$table->string('last_error')->nullable();
|
|
$table->timestamps();
|
|
|
|
$table->index(['user_id', 'enabled']);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('notifiers');
|
|
}
|
|
};
|