from app import create_app, db from sqlalchemy import text app = create_app() with app.app_context(): # Disable foreign key checks db.session.execute(text('SET FOREIGN_KEY_CHECKS = 0')) # Reflect all tables db.reflect() # Drop all tables db.drop_all() # Recreate all tables db.create_all() # Enable foreign key checks db.session.execute(text('SET FOREIGN_KEY_CHECKS = 1')) print("All tables dropped and recreated.")