pratikbackend / check_columns.py
Antaram's picture
Upload 109 files
2f5dcf7 verified
Raw
History Blame Contribute Delete
604 Bytes
import asyncio
from app.core.database import engine
from sqlalchemy import text
async def check():
async with engine.connect() as conn:
for table in ['transactions', 'patti_transactions']:
res = await conn.execute(text(f"SELECT column_name FROM information_schema.columns WHERE table_name='{table}' AND column_name='payment_method'"))
columns = res.all()
print(f"Table {table} columns found: {columns}")
if not columns:
print(f"Column 'payment_method' MISSING in {table}!")
if __name__ == "__main__":
asyncio.run(check())