Auto-run migration script on docker entrypoint (#11338)

A small PR but a big step towards making Twenty easier to self-host and
upgrade!

Now changing the tag and pulling a new version should be the only step
to upgrade as migrations script will be ran automatically upon starting
the containers. It was already the case for typeorm migrations, but not
for standard objects migration and data migration scripts. It is still
possible to disable this behavior for the most complex deployments such
as our own cloud.
This commit is contained in:
Félix Malfait
2025-04-02 15:37:51 +02:00
committed by GitHub
parent 55eadf1ab4
commit e94065fb44
2 changed files with 10 additions and 0 deletions

View File

@ -17,6 +17,7 @@ if [ "${DISABLE_DB_MIGRATIONS}" != "true" ] && [ ! -f /app/docker-data/db_status
# Run setup and migration scripts
NODE_OPTIONS="--max-old-space-size=1500" tsx ./scripts/setup-db.ts
yarn database:migrate:prod
yarn command:prod upgrade
# Mark initialization as done
echo "Successfuly migrated DB!"