<?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::table('campaigns', function (Blueprint $table) {
            $table->unsignedInteger('opens_count')->default(0)->after('emails_failed');
            $table->unsignedInteger('unique_opens')->default(0)->after('opens_count');
            $table->unsignedInteger('clicks_count')->default(0)->after('unique_opens');
            $table->unsignedInteger('unique_clicks')->default(0)->after('clicks_count');
            $table->unsignedInteger('unsubscribes_count')->default(0)->after('unique_clicks');
            $table->unsignedInteger('conversions_count')->default(0)->after('unsubscribes_count');
        });
    }

    public function down(): void
    {
        Schema::table('campaigns', function (Blueprint $table) {
            $table->dropColumn(['opens_count', 'unique_opens', 'clicks_count', 'unique_clicks', 'unsubscribes_count', 'conversions_count']);
        });
    }
};
