v1.2.21: fix broken advisory lock (→ partial unique index), escName add " escape, lock_check fallback False
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user