v1.2.21: fix broken advisory lock (→ partial unique index), escName add " escape, lock_check fallback False

This commit is contained in:
2026-07-31 18:17:09 +04:00
parent 5065019ffd
commit 06eb463088
5 changed files with 27 additions and 52 deletions
+6
View File
@@ -112,6 +112,12 @@ CREATE INDEX IF NOT EXISTS idx_scenario_runs_client_stand
CREATE INDEX IF NOT EXISTS idx_scenario_runs_status
ON scenario_runs (client_id, stand, status);
-- Partial unique index — атомарный lock на уровне БД.
-- Гарантирует что только ОДИН сценарий может быть RUNNING для client_id+stand.
-- Вторая параллельная вставка получит unique violation → 409 без гонок.
CREATE UNIQUE INDEX IF NOT EXISTS idx_one_running
ON scenario_runs (client_id, stand) WHERE status = 'RUNNING';
-- Миграции для scenario_runs
ALTER TABLE scenario_runs ADD COLUMN IF NOT EXISTS definition_id INTEGER;
ALTER TABLE scenario_runs ADD COLUMN IF NOT EXISTS definition_version INTEGER;