Files
MoneyFlix/crm/Core/Database/Migrations/ExpandSiteGroupsStatusEnum.php
T
1sonhador 9d43854277 feat: Initial MoneyFlix project setup
- 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.
2025-10-03 12:09:41 +01:00

48 lines
1.8 KiB
PHP

<?php
namespace App\Core\Database\Migrations;
use App\Core\Database\Migration;
use App\Core\Database\SchemaBuilder;
class ExpandSiteGroupsStatusToVarchar extends Migration
{
public function up(): void
{
$this->log("🔄 Converting site groups status from ENUM to VARCHAR for Google Sheets integration");
// Convert status from ENUM to VARCHAR(50) to support all Google Sheets status values
// Following project preference for VARCHAR over ENUM as documented in DATABASE_SOFT_DELETE_GUIDE.md
$sql = "ALTER TABLE advertising_site_groups
MODIFY COLUMN status VARCHAR(50) NOT NULL DEFAULT 'active'";
$this->db->query($sql);
$this->log("✅ Site groups status converted to VARCHAR(50) successfully");
$this->log("📝 Now supports all Google Sheets status values without ENUM limitations");
}
public function down(): void
{
$this->log("🔄 Reverting site groups status to original ENUM values");
// First, update any non-standard status values to 'inactive'
$this->db->query("UPDATE advertising_site_groups
SET status = 'inactive'
WHERE status NOT IN ('active', 'inactive', 'pending')");
// Revert to original enum (though project prefers VARCHAR)
$sql = "ALTER TABLE advertising_site_groups
MODIFY COLUMN status ENUM('active','inactive','pending')
NOT NULL DEFAULT 'active'";
$this->db->query($sql);
$this->log("✅ Site groups status reverted to original ENUM (not recommended)");
}
public function getDescription(): string
{
return "Convert site groups status from ENUM to VARCHAR(50) for Google Sheets integration";
}
}