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

27
init_db.py Normal file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env python
"""Initialize the database migrations manually"""
import os
import sys
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate, init
# Create a minimal Flask app
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL', 'sqlite:////data/timetrack.db')
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
# Create db and migrate instances
db = SQLAlchemy(app)
migrate = Migrate(app, db)
if __name__ == '__main__':
with app.app_context():
print("Initializing migration repository...")
try:
init()
print("Migration repository initialized successfully!")
except Exception as e:
print(f"Error: {e}")
sys.exit(1)