diff --git a/database.py b/database.py index 1cb57d8..be06b58 100644 --- a/database.py +++ b/database.py @@ -1299,6 +1299,17 @@ async def init_db(): """) logger.info("Added apple_id column to users (Pleily)") + # difficulty + col_exists = await conn.fetchval(""" + SELECT 1 FROM information_schema.columns + WHERE table_name = 'users' AND column_name = 'difficulty' + """) + if not col_exists: + await conn.execute(""" + ALTER TABLE users ADD COLUMN difficulty TEXT DEFAULT 'medium' + """) + logger.info("Added difficulty column to users (Pleily)") + # app_user_id_seq — sequence для отрицательных user_id await conn.execute(""" CREATE SEQUENCE IF NOT EXISTS app_user_id_seq