Replies: 9 comments
-
Hi @calebboyd, if you are running the migrations on two different machines in parallel (or even on one machine twice), you will probably have awkward times, since the migration is only marked as executed, when it finished. So you should make sure to only run the migration once |
Beta Was this translation helpful? Give feedback.
-
@sdepold I'm wondering if migrations should be executed and (un)logged in a single transaction unit or two if storage != DB? |
Beta Was this translation helpful? Give feedback.
-
I think I tried that at some point and noticed that for example structural changes cannot be wrapped (at least not for every db) in a transaction. Can you elaborate on that idea @jukkah ? |
Beta Was this translation helpful? Give feedback.
-
@sdepold You are right, it will not work. At least, in MySQL, DDL statements cannot be rolled back. @calebboyd's problem can be still resolved by locking the storage (file or table) as he originally suggested. |
Beta Was this translation helpful? Give feedback.
-
@calebboyd we were facing the same issue and a workaround we found was:
The whole process is automated. :) |
Beta Was this translation helpful? Give feedback.
-
Maybe we can make this work by locking the The first process running the migrations will issue a I don't know about other databases, but I think there are equivalent solutions for most of them. At least, I believe that's how Flyway tackles this issue. There are several implementations for all supported databases of the |
Beta Was this translation helpful? Give feedback.
-
migrations table lock is used successfully in rails migrations for years and I'm truly shocked it is not even an option in Sequelize |
Beta Was this translation helpful? Give feedback.
-
I just got this problem as a devops. it's really the wtf moment here. where are the locks? why nodejs comunity is like that most of the time... Gone back into my cave to build another shit tech workaround with some sticks and sticky tape, as I don't know how to code that dumb nodejs... |
Beta Was this translation helpful? Give feedback.
-
Alright, guys, finally it's here: db-migrator-distributed. For the lack of a better name, that's what I chose... :D Enjoy, give feedback and contribute! 🙌 |
Beta Was this translation helpful? Give feedback.
-
We're getting ready to deploy a schema using umzug for migrations. I was wondering (couldn't find in the docs) if the logs table acted as a mutex in the event the applications were scaled horizontally in front of a single database. eg. ensuring that
my-migration.js
was only started and completed once even if multiple servers run it against the same database.Beta Was this translation helpful? Give feedback.
All reactions