phase 8 and 9
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?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('alerts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('website_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('name');
|
||||
$table->string('metric'); // page_views, visitors, sessions, bounce_rate, goal_conversions
|
||||
$table->string('condition'); // above, below, change_up, change_down
|
||||
$table->decimal('threshold', 12, 2);
|
||||
$table->string('period')->default('daily'); // daily, hourly
|
||||
$table->string('channel')->default('email'); // email, in_app, both
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamp('last_triggered_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('alert_notifications', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('alert_id')->constrained()->cascadeOnDelete();
|
||||
$table->decimal('value', 12, 2);
|
||||
$table->text('message');
|
||||
$table->boolean('is_read')->default(false);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('alert_notifications');
|
||||
Schema::dropIfExists('alerts');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user