Files
analytics/database/migrations/2026_03_17_000006_create_goals_table.php
T

30 lines
811 B
PHP
Raw Normal View History

2026-03-24 21:12:21 +01:00
<?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('goals', function (Blueprint $table) {
$table->id();
$table->foreignId('website_id')->constrained()->cascadeOnDelete();
$table->string('name');
$table->string('type', 30);
$table->json('conditions');
$table->decimal('default_value', 15, 4)->nullable();
$table->boolean('is_active')->default(true);
$table->timestamps();
$table->index(['website_id', 'is_active']);
});
}
public function down(): void
{
Schema::dropIfExists('goals');
}
};