Files
MoneyFlix/crm/Modules/Advertising/Database/Migrations/CreateSyncVersionsTable.php
1sonhador 88a5659fe8 fix: Correct user permissions and UserModel query
- Fix storage permissions to use 'www' user instead of 'www-data'
- Fix UserModel getAllForAdmin query to avoid placeholders in LIMIT/OFFSET
- Import missing modules: Advertising, Dashboard, Analytics
- Update deploy script to copy files to public directory
2025-10-15 14:14:00 +01:00

46 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
use App\Core\Database\Migration;
/**
* Migration: Create advertising_sync_versions table
*
* This migration creates a table to track synchronization versions
* for Google Sheets integration and script-builder compatibility.
*/
class CreateSyncVersionsTable extends Migration
{
/**
* Run the migration
*/
public function up(): void
{
$sql = "
CREATE TABLE IF NOT EXISTS advertising_sync_versions (
id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
type VARCHAR(50) NOT NULL UNIQUE COMMENT 'Type of sync (trackers_json, sheets_campaigns, etc.)',
version VARCHAR(32) NOT NULL COMMENT 'MD5 hash of current version',
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
INDEX idx_type (type),
INDEX idx_updated_at (updated_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
COMMENT='Track synchronization versions for Google Sheets integration'
";
$this->db->query($sql);
echo "✅ Created advertising_sync_versions table\n";
}
/**
* Reverse the migration
*/
public function down(): void
{
$this->db->query("DROP TABLE IF EXISTS advertising_sync_versions");
echo "✅ Dropped advertising_sync_versions table\n";
}
}