0

so while deploying into one test env (which has 2 instances of the server/API running), I started to receive ActiveRecord::ConcurrentMigrationError, after some digging I realize that my 2 instances run migrations separate and that causes the issue, after receiving this error no migrations are applied at all.

Checked using: rake db:migrate:status

I looked into the platform, and I found some info related to this error but I don't think are the proper solution, because the solution is to deactivate the lock introduced in rails 5 which can cause some weird issues during migrations (maybe I missed something if so, please let me know ).

Solution found

So the question:

Is there any way to solve this issue without deactivating the lock, or is that the proper solution (apart from only leave one of the instance instead of the 2 run the migration)?

Note: I would like to keep my migrations running automatically in both instances (just after the release) as usual.

Thx in advance .

r4cc00n
  • 1,927
  • 1
  • 8
  • 24
  • Are you sure "no migrations are applied at all"? Usually an error like this would come from the second instance trying to run the migrations, but the first instance might get through OK. If that's the case then you could just catch and ignore the error. – Dave Slutzkin Jan 13 '21 at 02:41
  • thx for the response, nop no migrations are applied – r4cc00n Jan 13 '21 at 03:57
  • How do you deploy your application? Do you use a tool like Capistrano or Chef? Or a built-in feature from your CI pipeline? Where do you deploy your application to? How are migrations triggered, manually, automatically? – spickermann Jan 13 '21 at 05:51
  • hey @spickermann thx for the response I am using gitla-ci and I am running the migrations in the entry point of the container with rake db:migrate – r4cc00n Jan 13 '21 at 14:47

0 Answers0