Performance: Database migration in deployment
MEDIUM IMPACT
This affects the deployment speed and application startup time during updates, impacting user experience and downtime.
def deploy(): # Run migrations as a separate step before or after deployment asynchronously # or during maintenance window run_migrations_async() app.run()
from flask_migrate import upgrade def deploy(): upgrade() # runs migrations synchronously during app startup app.run()
| Pattern | Blocking Deployment | User Downtime | Startup Delay | Verdict |
|---|---|---|---|---|
| Synchronous migration during app start | Yes | High | Long (seconds to minutes) | [X] Bad |
| Asynchronous or pre-deployment migration | No | Low | Minimal | [OK] Good |