Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy crashed after migrating v1 to v2 - Error: P3005 The database schema is not empty. #2005

Closed
meirroth opened this issue Apr 27, 2023 · 4 comments

Comments

@meirroth
Copy link
Contributor

Hi @mikecao,

  • I'm hosting on Railway.app.
  • @umami/migrate-v1-v2 was successful.
  • Pulled upstream to update from v1.40.0 to v2.2.0.
  • Build on railway was successful.

However, deployment crashed with the the following error log:

yarn run v1.22.19
$ npm-run-all check-db update-tracker start-server
$ node scripts/check-db.js
✓ DATABASE_URL is defined.
✓ Database connection successful.
✓ Database version check successful.
Error: P3005
The database schema is not empty. Read more about how to baseline an existing production database: https://pris.ly/d/migrate-baseline
✗ Command failed: prisma migrate deploy
Error: P3005
The database schema is not empty. Read more about how to baseline an existing production database: https://pris.ly/d/migrate-baseline
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "check-db" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Any ideas as to how I can fix this? If there's any more info you need let me know.
Thank you

@franciscao633
Copy link
Collaborator

Can you check the records in your _prisma_migrations table? Should have a record for 01_init from the @umami/migrate-v1-v2. Error usually occurs when the table is missing.

@meirroth
Copy link
Contributor Author

@franciscao633 Thank you for your prompt response!
I don't see a _prisma_migrations table. I've got these tables:

_event_old
event_data
session
team
team_user
team_website
user
website
website_event

@franciscao633
Copy link
Collaborator

from the root of your umami repo try running these commands.

  1. make sure you have env file for DATABASE_URL pointing to your railway db
  2. yarn build-db
  3. npx prisma migrate resolve --applied 01_init
  4. redeploy

@meirroth
Copy link
Contributor Author

@franciscao633 Done, and issue resolved 😀
Thank you so much for the support! BTW, v2 looks great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants