0

I'm using Sequelize for my PostgreSQL in a node app.

Let me elaborate my question. I had two migrations - one that created a table and the other that added a column to it.

I can see those migration entries in the SequelizeMeta table in my psql but the issue is when I go and delete one of those migration files from my project, the corresponding entry doesn't go away.

I can understand that I have to run sequelize commands thereafter for the conflict to appear but it still doesn't show anything when I try to run the sequelize commands.

For instance, after having run both of the migrations and then deleting the second one, I ran sequelize db:migrate:undo:all to only see that it was able to correctly run the revert for the first CREATE table migration only.

It totally ignored the entry of the second migration from the SequelizeMeta table.

When I ran db:migrate, it also didn't throw me any errors when I hoped it would look for the second migration file. It just ran the first one.

P.S. Where is the sync between migrations and SequelizeMeta table then? Or sequelize-meta for that matter?

Here's an open issue.

Aakash Verma
  • 3,705
  • 5
  • 29
  • 66
  • Removing one migration that already has been run on a production database is typically not something that happens, unless you're deleting many old migrations. Perhaps you can explain why you feel you want to remove this one migration so that we can better explain how your task could be accomplished? – Mark Hildreth Feb 11 '18 at 20:07
  • Please read my question title again - yes, I understand and am totally against it. But in the event of "deleting older migrations", why isn't the SequelizeMeta table updated when there is an undo migration run subsequent to the deletion of the migration file? Only during the `db:migrate` does it go ahead with updating the table... The table feels more like a log file to me! – Aakash Verma Feb 13 '18 at 19:17

0 Answers0