37338-vm/db/migrations/022_add_is_active_to_process_definitions.php
2026-01-10 22:04:53 +00:00

22 lines
729 B
PHP

<?php
require_once __DIR__ . '/../config.php';
function migrate_022($pdo) {
try {
$sql = "ALTER TABLE process_definitions ADD COLUMN is_active TINYINT(1) NOT NULL DEFAULT 1 AFTER definition_json";
$pdo->exec($sql);
echo "Migration successful: is_active column added to process_definitions table.\n";
} catch (PDOException $e) {
// Ignore if column already exists
if ($e->getCode() !== '42S21') {
die("Migration failed: " . $e->getMessage() . "\n");
}
}
}
// If called directly, run the migration
if (basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) {
require_once __DIR__ . '/../../db/config.php';
$pdo = db();
migrate_022($pdo);
}