29 lines
1,002 B
Python
29 lines
1,002 B
Python
"""
|
||
Миграция v1.16: добавить колонку meter_reminders_enabled в таблицу users
|
||
"""
|
||
import sqlite3
|
||
import asyncio
|
||
|
||
DB_PATH = 'database/domovoy.db'
|
||
|
||
async def migrate():
|
||
conn = sqlite3.connect(DB_PATH)
|
||
cursor = conn.cursor()
|
||
|
||
# Проверяем, есть ли уже колонка meter_reminders_enabled
|
||
cursor.execute("PRAGMA table_info(users)")
|
||
columns = [col[1] for col in cursor.fetchall()]
|
||
|
||
if 'meter_reminders_enabled' in columns:
|
||
print("ℹ️ Колонка meter_reminders_enabled уже существует")
|
||
else:
|
||
print("➕ Добавляем колонку meter_reminders_enabled в таблицу users...")
|
||
cursor.execute("ALTER TABLE users ADD COLUMN meter_reminders_enabled BOOLEAN DEFAULT 1")
|
||
print("✅ Колонка добавлена")
|
||
|
||
conn.commit()
|
||
conn.close()
|
||
print("✅ Миграция v1.16 завершена!")
|
||
|
||
if __name__ == '__main__':
|
||
asyncio.run(migrate())
|