sequelize db:migrate not working on Heroku
See original GitHub issueHi,
I did all the following steps for creating a PG db on Heroku, but when I try to do a migration it doesn’t work and I get this error:
heroku run sequelize db:migrate
Running sequelize db:migrate on murmuring-refuge-53970... up, run.1235
Sequelize [Node: 5.11.0, CLI: 2.4.0, ORM: 3.22.0]
Loaded configuration file "server/db/sequelize/sequelize_config.js".
Using environment "production".
Unable to connect to database: SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:5432
Any ideas?
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
sequelize migrations in heroku - node.js - Stack Overflow
When you initialize sequelize locally by running: sequelize -i. a migration folder, config folder, and config.json inside the config folder are created.
Read more >Sequelize Automatic Database Migration and Seeding on ...
To automatically run migrations and seeders before the heroku app built, create Procfile contains migrate and seed command. # Procfileweb: npx ...
Read more >Heroku Sequelize NodeJS apps step by step - AVENTRA
Heroku Sequelize NodeJS apps step by step. Data base in heroku should be migrated seperately. git push heroku master will not run migration....
Read more >[Solved]-heroku sequelize: command not found-sequelize.js
If you want to run db:migrate using sequelize-cli then do the following steps: add sequelize-cli as a dependency in your package.json; add migrate:...
Read more >Sequelize-CLI, Node, Heroku Error - Reddit
This is probably not a problem with npm. ... heroku run sequelize db:migrate --env production --app locals-deploy. Error:
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Figured it out. On server/db/postgres/sequelize_config.js:
You should remove username, password, database and host on the production hash.
From this hash:
It should look something like this:
Make sure the POSTGRES_DB_URL is the correct Heroku ENV variable for your postgres db url on heroku.
Hopefully this answer saves you time. 😃
Having same issue on fresh clone. @coderjonny did you end up finding a solution?