diff --git a/database.py b/database.py index 73d07d6..1581f6b 100644 --- a/database.py +++ b/database.py @@ -938,6 +938,47 @@ async def init_db(): """) logger.info("Added hinted_words column to bubble_words_progress") + # 🔧 НОВОЕ (15.10.2026): words_collected — суммарно собранных слов + # в пузырях. Нужен для достижения bubble_words (собрать N слов). + col_exists = await conn.fetchval(""" + SELECT 1 FROM information_schema.columns + WHERE table_name = 'bubble_words_progress' AND column_name = 'words_collected' + """) + if not col_exists: + await conn.execute(""" + ALTER TABLE bubble_words_progress + ADD COLUMN words_collected INTEGER DEFAULT 0 + """) + logger.info("Added words_collected column to bubble_words_progress") + + # 🔧 НОВОЕ (15.10.2026): no_hints_streak — серия уровней БЕЗ подсказок + # и без «показать слова». +1 если hints_used == 0 и not list_opened, + # иначе сброс в 0. Нужен для достижения bubble_streak. + col_exists = await conn.fetchval(""" + SELECT 1 FROM information_schema.columns + WHERE table_name = 'bubble_words_progress' AND column_name = 'no_hints_streak' + """) + if not col_exists: + await conn.execute(""" + ALTER TABLE bubble_words_progress + ADD COLUMN no_hints_streak INTEGER DEFAULT 0 + """) + logger.info("Added no_hints_streak column to bubble_words_progress") + + # 🔧 НОВОЕ (15.10.2026): perfect_streak — серия идеальных уровней + # (без подсказок + без списка + без ошибок). +1 если всё чисто, + # иначе сброс в 0. Нужен для достижения bubble_perfect_streak. + col_exists = await conn.fetchval(""" + SELECT 1 FROM information_schema.columns + WHERE table_name = 'bubble_words_progress' AND column_name = 'perfect_streak' + """) + if not col_exists: + await conn.execute(""" + ALTER TABLE bubble_words_progress + ADD COLUMN perfect_streak INTEGER DEFAULT 0 + """) + logger.info("Added perfect_streak column to bubble_words_progress") + # ============ wrong_because_explanations ============ await conn.execute(""" CREATE TABLE IF NOT EXISTS wrong_because_explanations (