ifixkart-admin/Backend/fix_db.py
Adithiyan bbd3a3e959 feat: initial commit — full platform snapshot
- Backend: FastAPI app with all models, services, schemas, routes
- Admin Panel: Next.js dashboard with all modules
  (CRM, POS, repairs, warranties, billing, notifications, etc.)
- Ecommerce: storefront (submodule) + product catalog
- AI Agents: .agents/ skill library for Antigravity IDE
- Docs: architecture, billing, notification gateway markdown
- Submodules: Backend/OpenWA, Ecommerce/File 2/storefront
2026-10-13 12:59:47 +05:30

25 lines
881 B
Python

from sqlalchemy import create_engine
from sqlalchemy.sql import text
from app.core.config.Config import settings
engines = [
create_engine(settings.CORE_DATABASE_URL),
create_engine(settings.CRM_DATABASE_URL),
create_engine(settings.COMMERCE_DATABASE_URL)
]
tables_to_drop = ["notification_attempts", "dead_letter_notifications", "whatsapp_sessions", "notifications"]
for engine in engines:
with engine.connect() as conn:
try:
print(f"Checking DB: {engine.url.database}")
for table in tables_to_drop:
try:
conn.execute(text(f'DROP TABLE IF EXISTS {table};'))
print(f"Dropped {table}")
except Exception as e: print(e)
conn.commit()
except Exception as e:
print(f"Error connecting to {engine.url.database}: {e}")
print('Done!')