Files
new_lottery_bot/check_db_schema.py
Andrey K. Choi 4a741715f5
Some checks reported errors
continuous-integration/drone/push Build encountered an error
feat: Полный рефакторинг с модульной архитектурой
- Исправлены критические ошибки callback обработки
- Реализована модульная архитектура с применением SOLID принципов
- Добавлена система dependency injection
- Создана новая структура: interfaces, repositories, components, controllers
- Исправлены проблемы с базой данных (добавлены отсутствующие столбцы)
- Заменены заглушки на полную функциональность управления розыгрышами
- Добавлены отчеты о проделанной работе и документация

Архитектура готова для production и легко масштабируется
2025-11-17 05:34:08 +09:00

59 lines
2.1 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
"""
Проверка схемы базы данных
"""
import asyncio
import sys
import os
sys.path.insert(0, os.path.dirname(__file__))
from src.core.database import engine
from sqlalchemy import text
async def check_database_schema():
"""Проверка схемы базы данных"""
print("🔍 Проверяем схему базы данных...")
async with engine.begin() as conn:
# Проверяем колонки таблицы users
result = await conn.execute(text(
"SELECT column_name, data_type, is_nullable "
"FROM information_schema.columns "
"WHERE table_name = 'users' AND table_schema = 'public' "
"ORDER BY column_name;"
))
print("\n📊 Колонки в таблице 'users':")
print("-" * 50)
columns = result.fetchall()
for column_name, data_type, is_nullable in columns:
nullable = "NULL" if is_nullable == "YES" else "NOT NULL"
print(f" {column_name:<20} {data_type:<15} {nullable}")
# Проверяем, есть ли поле phone
phone_exists = any(col[0] == 'phone' for col in columns)
if phone_exists:
print("\n✅ Поле 'phone' найдено в базе данных")
else:
print("\n❌ Поле 'phone' НЕ найдено в базе данных")
# Проверяем, есть ли поле verification_code
verification_code_exists = any(col[0] == 'verification_code' for col in columns)
if verification_code_exists:
print("✅ Поле 'verification_code' найдено в базе данных")
else:
print("❌ Поле 'verification_code' НЕ найдено в базе данных")
async def main():
"""Основная функция"""
try:
await check_database_schema()
except Exception as e:
print(f"❌ Ошибка при проверке базы данных: {e}")
finally:
await engine.dispose()
if __name__ == "__main__":
asyncio.run(main())