Upgrading
Upgrading to v4
Before You Start
- Back up your database:
pg_dump <your-database-name> > bayanat-backup-$(date +%Y%m%d).sql- Run diagnostics from your Bayanat directory to check current health:
uv run flask doctorReview the output. Fix any failures before proceeding.
TIP
All commands below should be run from your Bayanat installation directory, as the user that owns the installation. Adapt paths and user context to match your setup.
Upgrade Steps
# 1. Pull the new code
git fetch --tags
git checkout v4.0.0
# 2. Install updated dependencies
uv sync --frozen
# 3. Run database migrations
uv run flask db upgrade
# 4. Restart your application and worker processesHow you restart depends on your setup:
- systemd:
sudo systemctl restart bayanat bayanat-celery - Docker: see Docker Upgrade below
- Other: restart your WSGI server and Celery worker however you normally do
Verify the Upgrade
# Run diagnostics - all checks should pass
uv run flask doctor
# Confirm migrations are current
uv run flask db currentLog in and verify the application works as expected.
What Changed in v4
See the changelog for a full list. Key changes that affect the upgrade:
- Database migrations now use Alembic. The
flask db upgradecommand replaces the old manual SQL files. You no longer need to apply SQL migrations manually. - New dependencies.
uv sync --frozeninstalls everything needed. - New CLI commands.
flask doctorchecks installation health.flask check-db-alignmentnow shows Alembic migration status.
Troubleshooting
flask db upgrade fails:
The migration runs inside a transaction. If it fails, nothing is changed. Check the error message, fix the issue, and run flask db upgrade again. If you're stuck, share the error output with the development team.
Application won't start after upgrade:
Check your application logs. Common causes: missing dependency (re-run uv sync --frozen), config change needed (check .env against .env-sample).
flask doctor shows warnings after upgrade:
Warnings are non-critical. Common expected warnings:
- "No Celery workers responding" - if you haven't restarted the worker yet
- "MAIL_SERVER not configured" - if email isn't set up (optional)
Failures (shown in red) need attention before the system is fully operational.
Standard Upgrade (future versions)
For routine upgrades after v4:
git pull
uv sync --frozen
uv run flask db upgradeThen restart your application and worker processes.
flask db upgrade is idempotent - safe to run multiple times. It detects what's already applied and skips it.
Docker Upgrade
For Docker deployments, rebuild and restart:
docker-compose down
docker-compose build
docker-compose up -dThe container entrypoint runs database setup and migrations automatically on startup.
Checking Status
See which migration your database is on:
uv run flask db currentCheck if your schema matches the models:
uv run flask check-db-alignmentRun full diagnostics:
uv run flask doctor