[Eva] Добавить 3 колонки в bubble_words_progress (current_list_opened, current_level_words, hinted_words)

This commit is contained in:
2026-10-14 09:10:45 +00:00
parent 4159d6265a
commit 13fcc8240d
+40
View File
@@ -898,6 +898,46 @@ async def init_db():
""") """)
logger.info("Added current_hints_used column to bubble_words_progress") 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 ============ # ============ wrong_because_explanations ============
await conn.execute(""" await conn.execute("""
CREATE TABLE IF NOT EXISTS wrong_because_explanations ( CREATE TABLE IF NOT EXISTS wrong_because_explanations (