auth email/password
This commit is contained in:
28
migrate_db.py
Normal file
28
migrate_db.py
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Database migration script for Flask-Migrate."""
|
||||
|
||||
import os
|
||||
from flask.cli import FlaskGroup
|
||||
from app import create_app
|
||||
from app.database import db
|
||||
|
||||
app = create_app()
|
||||
cli = FlaskGroup(app)
|
||||
|
||||
@cli.command()
|
||||
def init_db():
|
||||
"""Initialize the database."""
|
||||
print("Initializing database...")
|
||||
db.create_all()
|
||||
print("Database initialized successfully!")
|
||||
|
||||
@cli.command()
|
||||
def reset_db():
|
||||
"""Reset the database (drop all tables and recreate)."""
|
||||
print("Resetting database...")
|
||||
db.drop_all()
|
||||
db.create_all()
|
||||
print("Database reset successfully!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
cli()
|
||||
Reference in New Issue
Block a user