Patryk Jabłoński
Patryk Jabłoński

Reputation: 747

Knex - Already up to date

I am struggling with a problem connected with the migrations in knex on the production environment (heroku). I have made some changes and created 8 new migrations to update the model. After creating new migrations I have reached 47 migration files. After uploading the changes to the Heroku I executed as usual knex migrate:latest and there was no effect. I have received the message Already up to date.

I have decided to take a look at the knex_migrations table to see if maybe something is wrong there. The result that I can see that the new migrations were not written into that database (please see the picture for reference.

enter image description here

When we take a look at the migrations it looks like this:

enter image description here

Clearly we can see that knex was able to run "20200216191040_receiver_company.js" as last one.

When I take a look at the knex_migrations_lock table the only entry that is existing over there looks like this:

enter image description here

Does anyone know how to force knex to run the migrations? The version of knex that I use it 0.16.3.

EDIT:

I want to add that on the local machine I have no problems with running the migrations. Additionally, I have checked if the migration files are present on the server and after pulling the current state our of the Heroku I can see all of the migration files that were not executed.

Upvotes: 2

Views: 1482

Answers (1)

Abed Murrar
Abed Murrar

Reputation: 101

If the change of the migration is not implemented in the database, you can try to manually remove the record of the migration from the knex_migrations or you migrations table, and try to re-apply the knex migrate:latest command.

but before you try this way, make sure to keep a backup, or run it on your local machine or development server first.

Upvotes: 2

Related Questions