Deploy: 2026-05-22 02:16:46

This commit is contained in:
Hamza-Ayed
2026-05-22 02:16:46 +03:00
parent f793092a17
commit 479aedcbcf
4 changed files with 128 additions and 68 deletions

View File

@@ -69,6 +69,7 @@ class CompanyEndpoint extends BaseModel
`endpoint_url` VARCHAR(512) NOT NULL,
`action_type` VARCHAR(100) NOT NULL,
`description` TEXT NULL,
`api_key` VARCHAR(255) NULL,
`headers` TEXT NULL,
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
@@ -76,6 +77,14 @@ class CompanyEndpoint extends BaseModel
INDEX `idx_endpoint_action` (`action_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
");
// Auto-migration: check if api_key column exists, if not, add it
try {
Database::execute("SELECT `api_key` FROM `company_endpoints` LIMIT 1");
} catch (\Exception $colException) {
Database::execute("ALTER TABLE `company_endpoints` ADD COLUMN `api_key` VARCHAR(255) NULL AFTER `description`");
}
$checked = true;
} catch (\Exception $e) {
error_log("Failed to ensure company_endpoints table: " . $e->getMessage());