synthex / recreate_tables.py
theaniketgiri's picture
backend
3f61e65
raw
history blame contribute delete
395 Bytes
from sqlalchemy import text
from app.core.database import Base, engine
from app.models.models import BetaApplication
# Drop all tables with CASCADE
with engine.connect() as conn:
conn.execute(text("DROP SCHEMA public CASCADE;"))
conn.execute(text("CREATE SCHEMA public;"))
conn.commit()
# Create all tables
Base.metadata.create_all(engine)
print("Tables recreated successfully.")