[BUG] Upgrade 1.5 -> 1.6.x fails
Closed this issue · 4 comments
Issue Summary
Trying to upgrade according to the guides fails at database migration
Steps to Reproduce
docker run --rm --network=formbricks_default -e DATABASE_URL="postgresql://postgres:postgres@postgres:5432/formbricks?schema=public" -e UPGRADE_TO_VERSION="v1.6" ghcr.io/formbricks/data-migrations:v1.6
Unable to find image 'ghcr.io/formbricks/data-migrations:v1.6' locally
docker: Error response from daemon: manifest unknown.
See 'docker run --help'.
If i use the specific image for 1.6.1 I get
sudo docker run --rm --network=formbricks_default -e DATABASE_URL="postgresql://postgres:postgres@postgres:5432/formbricks?schema=public" -e UPGRADE_TO_VERSION="v1.6" ghcr.io/formbricks/data-migrations:v1.6.1
> @formbricks/database@0.1.0 data-migration:v1.6 /app/packages/database
> ts-node ./migrations/20240207041922_advanced_targeting/data-migration.ts
PrismaClientKnownRequestError:
Invalid `prisma.survey.findMany()` invocation in
/app/packages/database/migrations/20240207041922_advanced_targeting/data-migration.ts:15:64
12
13 async function main() {
14 await prisma.$transaction(async (tx) => {
→ 15 const allSurveysWithAttributeFilters = await prisma.survey.findMany(
The column `Survey.createdBy` does not exist in the current database.
at In.handleRequestError (/app/node_modules/@prisma/client/runtime/library.js:122:6854)
at In.handleAndLogRequestError (/app/node_modules/@prisma/client/runtime/library.js:122:6188)
at In.request (/app/node_modules/@prisma/client/runtime/library.js:122:5896)
at async l (/app/node_modules/@prisma/client/runtime/library.js:127:10871)
at async /app/packages/database/migrations/20240207041922_advanced_targeting/data-migration.ts:15:44
at async Proxy._transactionWithCallback (/app/node_modules/@prisma/client/runtime/library.js:127:9534)
at async main (/app/packages/database/migrations/20240207041922_advanced_targeting/data-migration.ts:14:3) {
code: 'P2022',
clientVersion: '5.11.0',
meta: { modelName: 'Survey', column: 'Survey.createdBy' }
}
ELIFECYCLE Command failed with exit code 1.
Expected behavior
Expected the migration to succeed
Other information
No response
Screenshots
No response
Environment
- Formbricks Cloud (app.formbricks.com)
- Self-hosted Formbricks
Desktop (please complete the following information)
- OS:
- Node:
- npm:
Thank you for opening your first issue! 🙏❤️ One of our team members will review it and get back to you as soon as it possible. 😊
The tag is incorrect in the doc. Should be:
docker run --rm --network=formbricks_default -e DATABASE_URL="postgresql://postgres:postgres@postgres:5432/formbricks?schema=public" -e UPGRADE_TO_VERSION="v1.6" ghcr.io/formbricks/data-migrations:v1.6.0
Thanks, tagging the migration container to v1.6.0
was still failing the migration script.
With help via Discord, one additional step helped to mitigate the issue:
Pinning the formbricks docker image to v1.6.1
:
Can you please try to set the version in the docker compose file to v1.6.1 instead of latest to be sure that the right version was getting pulled and started?
formbricks:
…
image: ghcr.io/formbricks/formbricks:v1.6.1
Finally to mitigate an issue with unpkg.com redirects, the client package needs to be pinned to 1.6.5
Please also upgrade to formbricks-js 1.6.5 as soon as possible to avoid any issues with the unpkg resolution.
npm install @formbricks/js@~1.6.5
Thanks @laurens for writing down and sharing your solution 😊