From 0875d5b9e63f217d2c01da88c09d1bc7cb4b5818 Mon Sep 17 00:00:00 2001 From: bot-backend Date: Mon, 13 Jul 2026 23:07:11 +0300 Subject: [PATCH] fix(tradein/quota): renumber migration 184 -> 185 (prefix collision) 184_user_events.sql merged into main (#2515) after this branch's base, claiming the 184 prefix first. Renumber account_quota_overrides to 185 (next free slot) and update the "migration 184" references in the SQL header comment and account_quota.py docstrings so test_migrations_manifest.py::test_new_files_do_not_reuse_prefix stays green. --- tradein-mvp/backend/app/services/account_quota.py | 4 ++-- ...nt_quota_overrides.sql => 185_account_quota_overrides.sql} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename tradein-mvp/backend/data/sql/{184_account_quota_overrides.sql => 185_account_quota_overrides.sql} (100%) diff --git a/tradein-mvp/backend/app/services/account_quota.py b/tradein-mvp/backend/app/services/account_quota.py index 07ace7af..75d2534b 100644 --- a/tradein-mvp/backend/app/services/account_quota.py +++ b/tradein-mvp/backend/app/services/account_quota.py @@ -5,7 +5,7 @@ месяц (UTC, период 'YYYY-MM'); конфигурируется через env ESTIMATE_QUOTA_LIMIT, default 15. - Персональный override: таблица account_quota_overrides (username → monthly_limit), - см. миграцию 184_account_quota_overrides.sql. Заменяет прежний хак бонусных попыток + см. миграцию 185_account_quota_overrides.sql. Заменяет прежний хак бонусных попыток через negative `used` (ломал /quota — «Осталось 50 из 15»). - Без лимита (unlimited): роль admin ИЛИ username == 'kopylov'. - Учитываются ТОЛЬКО успешные оценки (инкремент ПОСЛЕ estimate_quality). @@ -61,7 +61,7 @@ def user_limit(db: Session, username: str) -> int: """Персональный месячный лимит для username, иначе глобальный MONTHLY_LIMIT. Источник override — таблица account_quota_overrides (см. миграцию - 184_account_quota_overrides.sql). Заменяет прежний хак бонусных попыток через + 185_account_quota_overrides.sql). Заменяет прежний хак бонусных попыток через negative `used`, который ломал /quota (limit=15, used=-35 → remaining=50 — «Осталось 50 из 15»). """ diff --git a/tradein-mvp/backend/data/sql/184_account_quota_overrides.sql b/tradein-mvp/backend/data/sql/185_account_quota_overrides.sql similarity index 100% rename from tradein-mvp/backend/data/sql/184_account_quota_overrides.sql rename to tradein-mvp/backend/data/sql/185_account_quota_overrides.sql