Let me search for information about Docker upgrades, database migrations, and the proper upgrade process for Twenty.This is a well-known pain point. The issue is that simply pulling a new image and restarting is not enough — Twenty requires you to explicitly run migration commands after updating the image. Here is the documented upgrade process:
Proper Upgrade Steps (Docker Compose)
1. Back up your database first:
docker exec -t {db_container_name_or_id} pg_dumpall -U {postgres_user} > databases_backup.sql
2. Update the image tag in your .env and pull:
docker compose pull
docker compose up -d
3. Run the database structure migration:
docker exec -it {server_container} yarn database:migrate:prod
This applies migrations to the core and metadata schemas and populates the _typeorm_migrations table.
4. Run the version-specific upgrade command:
docker exec -it {server_container} yarn command:prod upgrade-X.YZ
For example, for upgrading to v0.35: yarn command:prod upgrade-0.35. This handles data migration for all workspaces and updates the workspace version.
Why your current approach breaks
Steps 2 and 3 above are the ones you are missing. The new Docker image contains the migration files and upgrade commands, but they are not executed automatically on container startup. You need to run them manually after the container is up.
Important notes
- Upgrade one version at a time. If you are going from v0.32 to v0.35, you need to go v0.32 -> v0.33 -> v0.34 -> v0.35, running the migrate and upgrade commands at each step.
- Always back up before each upgrade.
- Check the upgrade guide for each specific version, as some versions have additional steps or breaking changes.
This should get you out of the manual ALTER TABLE cycle entirely — the migration commands handle all schema changes, new columns, and workspace version updates for you.
These pages cover the full details: