- Created separate MoneyFlix project directory - Copied Node.js redirector from production server - Added CRM PHP code (Redirects module, Core classes, Config, Routes, Views) - Created comprehensive documentation (README_MONEYFLIX.md) - Added sync script to keep CRM code updated (sync-from-crm.sh) - Configured .gitignore for Node.js and PHP - Set up proper project structure for multi-client isolation This separates MoneyFlix from the main CRM to avoid confusion between different client systems and provides a dedicated environment for MoneyFlix-specific development and maintenance.
49 lines
2.1 KiB
PHP
49 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Core\Database\Migrations;
|
|
|
|
use App\Core\Database\Migration;
|
|
use App\Core\Database\SchemaBuilder;
|
|
|
|
/**
|
|
* Migration: Create Campaign Domains Table
|
|
*
|
|
* Creates advertising_campaign_domains table for optional campaign-specific domains.
|
|
* This allows campaigns to target specific domains within their site group.
|
|
*/
|
|
class CreateCampaignDomainsTable extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
$this->schema->createTable('advertising_campaign_domains', function (SchemaBuilder $table) {
|
|
$table->id();
|
|
$table->varchar('cuid', 64)->unique()->comment('CUID2 identifier');
|
|
$table->unsignedBigInteger('campaign_id')->index()->comment('Foreign key to advertising_campaigns');
|
|
$table->unsignedBigInteger('site_domain_id')->index()->comment('Foreign key to advertising_site_domains');
|
|
$table->tinyInteger('status')->default(1)->index()->comment('1=active, 0=inactive, -1=deleted');
|
|
$table->json('targeting_settings')->nullable()->comment('Domain-specific targeting settings');
|
|
$table->unsignedBigInteger('created_by')->index()->comment('User who created this association');
|
|
$table->timestamps();
|
|
$table->timestamp('deleted_at')->nullable()->index();
|
|
|
|
// Foreign key constraints
|
|
$table->foreignKey('campaign_id', 'advertising_campaigns', 'id', 'CASCADE', 'CASCADE');
|
|
$table->foreignKey('site_domain_id', 'advertising_site_domains', 'id', 'CASCADE', 'CASCADE');
|
|
$table->foreignKey('created_by', 'users', 'id', 'CASCADE', 'CASCADE');
|
|
|
|
// Unique constraint to prevent duplicate campaign-domain associations
|
|
$table->unique(['campaign_id', 'site_domain_id'], 'unique_campaign_domain');
|
|
|
|
// Indexes for performance
|
|
$table->index(['campaign_id', 'status'], 'idx_campaign_status');
|
|
$table->index(['site_domain_id', 'status'], 'idx_domain_status');
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
$this->schema->dropTable('advertising_campaign_domains');
|
|
}
|
|
} |