18 lines
622 B
Python
18 lines
622 B
Python
from sqlalchemy import create_engine, text
|
|
from app.config import DATABASE_URL, TABLE_PREFIX
|
|
|
|
def drop_user_table():
|
|
engine = create_engine(DATABASE_URL)
|
|
table_name = f"{TABLE_PREFIX}Users"
|
|
lower_table_name = f"{TABLE_PREFIX}users"
|
|
|
|
with engine.connect() as conn:
|
|
# Try dropping both case variants to be sure
|
|
conn.execute(text(f"DROP TABLE IF EXISTS {table_name}"))
|
|
conn.execute(text(f"DROP TABLE IF EXISTS {lower_table_name}"))
|
|
conn.commit()
|
|
print(f"Dropped table {table_name} (and lowercase variant if existed).")
|
|
|
|
if __name__ == "__main__":
|
|
drop_user_table()
|