mattes / migrate

Database migrations. CLI and Golang library.
Other
2.29k stars 326 forks source link

Solve lock contention problem when upgrading multiple logical MySQL databases backed by a single physical database. #248

Closed biefy closed 7 years ago

biefy commented 7 years ago

In MySQL driver, lock name is purely determined by the database name. However, it is quite common that multiple logical databases are physically backed by one single physical database. To make such logically isolated database migration work, we can specify different migration table for different logical database. The only problem is: migrating them in parallel will fail if another migrater holds the lock.

This change is to let lock name uses both database name and migration table name.

mattes commented 7 years ago

thanks