Merge db-migrations: Add Flask-Migrate support and clean up old migration system

This commit is contained in:
2025-07-13 12:17:20 +02:00
parent 7140aeba41
commit 1500b2cf88
65 changed files with 2153 additions and 7881 deletions

23
create_migration.py Normal file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env python
"""Create a new migration with Flask-Migrate"""
import os
import sys
from flask_migrate import migrate as _migrate
from app import app, db
if __name__ == '__main__':
with app.app_context():
print("Creating migration...")
try:
# Get migration message from command line or use default
message = sys.argv[1] if len(sys.argv) > 1 else "Initial migration"
# Create the migration
_migrate(message=message)
print(f"Migration '{message}' created successfully!")
print("Review the migration file in migrations/versions/")
print("To apply the migration, run: python apply_migration.py")
except Exception as e:
print(f"Error creating migration: {e}")
sys.exit(1)