File size: 860 Bytes
136c0f7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | from sqlalchemy import text
from webpass import create_app, db
app = create_app()
with app.app_context():
print("[-] Disabling Foreign Key Checks...")
# This tells MySQL: "Don't complain about connections between tables, just delete them."
db.session.execute(text("SET FOREIGN_KEY_CHECKS = 0"))
print("[-] Manually dropping ghost 'credential' table...")
# Explicitly delete the table that is causing the error
db.session.execute(text("DROP TABLE IF EXISTS credential"))
print("[-] Dropping all remaining tables...")
db.drop_all()
print("[-] Creating new schema (User, BiometricDevice, DeadDrop)...")
db.create_all()
print("[-] Re-enabling Foreign Key Checks...")
db.session.execute(text("SET FOREIGN_KEY_CHECKS = 1"))
db.session.commit()
print("[+] Database reset successful!") |