HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: /home/xedaptot/be.naniguide.com/database/migrations/2026_04_10_200013_create_ad_pixels_table.php
<?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('ad_pixels', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('uid', 32)->unique();
            $table->integer('customer_id')->unsigned();
            $table->string('platform', 20);
            $table->string('pixel_id', 255);
            $table->text('access_token')->nullable();
            $table->string('status', 20)->default('active');
            $table->json('settings')->nullable();
            $table->timestamp('last_verified_at')->nullable();
            $table->timestamps();

            $table->foreign('customer_id')->references('id')->on('customers')->onDelete('cascade');
        });

        Schema::create('ad_conversions', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('ad_pixel_id')->unsigned();
            $table->string('event_name', 50);
            $table->string('source_url', 2048)->nullable();
            $table->decimal('value', 12, 2)->nullable();
            $table->string('currency', 10)->nullable();
            $table->json('attribution')->nullable();
            $table->timestamps();

            $table->foreign('ad_pixel_id')->references('id')->on('ad_pixels')->onDelete('cascade');
            $table->index(['ad_pixel_id', 'created_at'], 'idx_conversion_pixel');
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('ad_conversions');
        Schema::dropIfExists('ad_pixels');
    }
};