diff --git a/database.py b/database.py index 440708f..73d07d6 100644 --- a/database.py +++ b/database.py @@ -898,6 +898,46 @@ async def init_db(): """) logger.info("Added current_hints_used column to bubble_words_progress") + # 🔧 НОВОЕ (14.10.2026): current_list_opened — серверный счётчик + # «показать слова» для текущего уровня пузырей. Medium — 1 раз. + col_exists = await conn.fetchval(""" + SELECT 1 FROM information_schema.columns + WHERE table_name = 'bubble_words_progress' AND column_name = 'current_list_opened' + """) + if not col_exists: + await conn.execute(""" + ALTER TABLE bubble_words_progress + ADD COLUMN current_list_opened INT DEFAULT 0 + """) + logger.info("Added current_list_opened column to bubble_words_progress") + + # 🔧 НОВОЕ (14.10.2026): current_level_words — состояние текущего + # уровня пузырей (слова + части + переводы). Нужно для подсказок, + # т.к. уровень генерируется на лету в /next и нигде не хранится. + col_exists = await conn.fetchval(""" + SELECT 1 FROM information_schema.columns + WHERE table_name = 'bubble_words_progress' AND column_name = 'current_level_words' + """) + if not col_exists: + await conn.execute(""" + ALTER TABLE bubble_words_progress + ADD COLUMN current_level_words JSONB DEFAULT '[]'::jsonb + """) + logger.info("Added current_level_words column to bubble_words_progress") + + # 🔧 НОВОЕ (14.10.2026): hinted_words — какие слова уже получили + # подсказку «первая часть» (для «каждый раз разное слово»). + col_exists = await conn.fetchval(""" + SELECT 1 FROM information_schema.columns + WHERE table_name = 'bubble_words_progress' AND column_name = 'hinted_words' + """) + if not col_exists: + await conn.execute(""" + ALTER TABLE bubble_words_progress + ADD COLUMN hinted_words TEXT[] DEFAULT '{}' + """) + logger.info("Added hinted_words column to bubble_words_progress") + # ============ wrong_because_explanations ============ await conn.execute(""" CREATE TABLE IF NOT EXISTS wrong_because_explanations (