first commit
This commit is contained in:
17
backend/drop_tables.py
Normal file
17
backend/drop_tables.py
Normal file
@@ -0,0 +1,17 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user