Spaces:
Runtime error
Runtime error
Download tests/reset_db_schema.py from Darshankumarr03/Swift-Query: direct link, hf CLI and curl.
- Browser
- Download file 589 Bytes
-
https://huggingface.co/spaces/Darshankumarr03/Swift-Query/resolve/main/tests/reset_db_schema.py
- Command line
-
hf download hf://spaces/Darshankumarr03/Swift-Query/tests/reset_db_schema.py
-
curl -L -o reset_db_schema.py https://huggingface.co/spaces/Darshankumarr03/Swift-Query/resolve/main/tests/reset_db_schema.py
589 Bytes
| from main import app, db | |
| from utils.db.db import Admin, Doctor, Patient, AdministrativeAssistant | |
| with app.app_context(): | |
| print("Dropping all existing tables to apply schema changes...") | |
| db.drop_all() | |
| print("Creating new tables...") | |
| db.create_all() | |
| # Re-create default admin user | |
| if not Admin.query.filter_by(username='admin').first(): | |
| admin = Admin(username='admin', password='password') | |
| db.session.add(admin) | |
| db.session.commit() | |
| print("Default admin (admin/password) created.") | |
| print("Database successfully reset.") | |