Swift-Query / tests /init_db.py
Darshan Kumar R
Deploy to Hugging Face Spaces (Clean)
ed0b977
Raw History Blame Contribute Delete
466 Bytes
import os
from main import app, db
from utils.db.db import Admin, Doctor, Patient, AdministrativeAssistant
with app.app_context():
# create the database and the db table
db.create_all()
# create a default admin user if one doesn't exist
if not Admin.query.filter_by(username='admin').first():
admin = Admin(username='admin', password='password')
db.session.add(admin)
db.session.commit()
print("Database initialized.")