ALTER TABLE runtime_maintenance_jobs DROP INDEX uk_runtime_running_node; ALTER TABLE runtime_maintenance_jobs DROP COLUMN running_node_id; ALTER TABLE runtime_maintenance_jobs ADD COLUMN running_node_id BIGINT UNSIGNED GENERATED ALWAYS AS (CASE WHEN status='running' OR (status='interrupted' AND action<>'runtime_change') THEN node_id ELSE NULL END) STORED; ALTER TABLE runtime_maintenance_jobs ADD UNIQUE KEY uk_runtime_running_node(running_node_id);