Open moltar opened 2 weeks ago
To resolve the issue with the confirmation prompt during migrations, follow these steps:
/packages/twenty-docker/twenty/entrypoint.sh
to use tsx
instead of npx ts-node
:#!/bin/sh
# Check if the initialization has already been done and that we enabled automatic migration
if [ "${ENABLE_DB_MIGRATIONS}" = "true" ] && [ ! -f /app/docker-data/db_status ]; then
echo "Running database setup and migrations..."
# Run setup and migration scripts
npx tsx ./scripts/setup-db.ts
yarn database:migrate:prod
# Mark initialization as done
echo "Successfuly migrated DB!"
touch /app/docker-data/db_status
fi
# Continue with the original Docker command
exec "$@"
tsx
as a dependency in package.json
:"dependencies": {
"tsx": "^3.8.0"
}
This will ensure that the script runs without prompting for confirmation.
/packages/twenty-docker/twenty/entrypoint.sh /packages/twenty-docker/twenty
Here, the script runs
npx ts-node
.On newer
npm
CLIs, this requires a--yes
flag, otherwise the following prompt is generated:This probably only happens in the interactive mode, I imagine, but it's still an annoyance.
Also, I think
ts-node
should be a dependency anyways, and perhaps baked into the image.Or better yet, use
tsx
(https://www.npmjs.com/package/tsx)https://github.com/twentyhq/twenty/blob/9228667a57b93843df5cbe0bcccffc6facf1ab90/packages/twenty-docker/twenty/entrypoint.sh#L8