Nick Tidswell
05/12/2026, 5:03 AMMarvin
05/12/2026, 5:03 AMMarvin
05/12/2026, 5:05 AMprefecthq/prefect:3.6.2 to either:
- prefecthq/prefect:3-latest
- or a pinned version like prefecthq/prefect:3.7.0
3. Run database migrations
This is the important part:
bash
prefect server database upgrade -y
If you run Prefect in Docker, run that against the same database your server uses.
4. Restart the server/services with the new image
Recommended precaution: pause schedules before upgrading, then resume them after, just to avoid any odd scheduler edge cases during the transition.
If you have a large database, especially lots of events, consider increasing the DB timeout during migration:
bash
PREFECT_API_DATABASE_TIMEOUT=600
A common Docker pattern is:
yaml
services:
prefect:
image: prefecthq/prefect:3-latest
environment:
PREFECT_API_DATABASE_CONNECTION_URL: <postgresql+asyncpg://user:pass@postgres:5432/prefect>
Then run:
bash
docker compose run --rm prefect prefect server database upgrade -y
docker compose up -d
If you run multiple Prefect API/server replicas, do not let all of them migrate on startup at once. Run the migration once first, then bring up the updated containers.
Useful docs:
- Upgrade to Prefect 3
- Self-hosted Prefect
- Database maintenance
If you want, paste your docker-compose.yml and I can point out the safest exact upgrade steps for your setup.