My wasp application is deployed in fly.io but the migration file is not running automatically
my wasp application is deployed in fly.io but i have migration issue i have like 20 migration and not running automatically when running the wasp deploy fly deploy command
2 Replies
Hi @victor. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the information provided in the knowledge sources, it appears that there might be an issue with your database migrations not being applied automatically during deployment. Here's what I can tell you:
1. Normally, Wasp runs migrations automatically on every application start in a deployed app. As mentioned in the Discord support thread (https://discord.com/channels/686873244791210014/1217295340785635418), "In a deployed app, we run the migrations on every application start. If there are any new migrations, they get applied, if not, nothing happens."
2. However, if you're experiencing issues with migrations not running, it's possible that you haven't run the
wasp db migrate-dev
command locally before deploying. This command is crucial for preparing your Prisma models for the database. As stated in the same Discord thread, "It's important to run that command to get the latest Prisma models ready for your DB (which will be added to your local DB when you run the command and on deploy to your production DB)."
3. To resolve this issue, you should try the following steps:
a. Run wasp db migrate-dev
locally to generate the migration files.
b. Commit these migration files to your repository.
c. Then run wasp deploy fly deploy
to deploy your updated app with the new migrations.
4. If the issue persists, you might need to investigate further. You can try connecting to your production database using the Fly CLI to check the state of your migrations, as suggested in the Discord thread:
Then use SQL commands to inspect the migrations table.
5. If you're still having trouble, it might be worth considering deleting the apps on Fly and redeploying, as suggested by a community member in the Discord thread.
Remember, it's crucial to run wasp db migrate-dev
locally before deploying to ensure your migrations are properly set up and ready to be applied in the production environment.
If these steps don't resolve your issue, you may need to seek further assistance from the Wasp community or support channels, as there might be specific details about your setup that require more in-depth troubleshooting.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @victor, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?Do you see any errors in the server logs?