- New models: WarrantyModel, WalletModel, SystemConfigModel - New schemas: WarrantySchema, RefundSchema, SystemConfig, CrmTaskCalendar, NotificationTemplate, NotificationGateway, RepairErp, ReviewModeration, InventoryPos, MultiDashboard, BillingFinance - New services: WarrantyService, RefundService, CrmService, CrmTaskCalendarService, DeliveryService, EmailTemplateService, InventoryPosService, MultiDashboardService, NotificationGatewayService, RepairErpService, ReviewModerationService, SystemConfigService, TemplateService, CreditService - Updated routers: AdminOrder, BillingFinance, Cart, Catalog, Checkout, Crm, InventoryPos, NotificationGateway, RolePermission, ServiceJob, Settings, Storefront, UserCreation - Updated models: Inventory, Notification, Order, Product, Service, Setting, SystemConfig, User - Updated core: database init, invoice generator, main app - Added WarrantyRouter with full CRUD and claim flow
25 lines
1 KiB
Python
25 lines
1 KiB
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)
|
|
]
|
|
|
|
for engine in engines:
|
|
with engine.connect() as conn:
|
|
print(f"Checking DB: {engine.url.database}")
|
|
tables = [t[0] for t in conn.execute(text('SHOW TABLES;')).fetchall()]
|
|
if 'notifications' in tables:
|
|
print("Dropping notification tables...")
|
|
conn.execute(text("SET FOREIGN_KEY_CHECKS = 0;"))
|
|
conn.execute(text("DROP TABLE IF EXISTS notification_attempts;"))
|
|
conn.execute(text("DROP TABLE IF EXISTS dead_letter_queue;"))
|
|
conn.execute(text("DROP TABLE IF EXISTS whatsapp_sessions;"))
|
|
conn.execute(text("DROP TABLE IF EXISTS notifications;"))
|
|
conn.execute(text("SET FOREIGN_KEY_CHECKS = 1;"))
|
|
conn.commit()
|
|
print("Dropped successfully.")
|
|
print('Done!')
|