Skip to content

Commit

Permalink
Use both db name and migration table name for lock hash
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuyuan Bie authored May 16, 2017
1 parent 2831b4c commit 5f2a8b7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions database/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ func (m *Mysql) Lock() error {
return database.ErrLocked
}

aid, err := database.GenerateAdvisoryLockId(m.config.DatabaseName)
aid, err := database.GenerateAdvisoryLockId(
fmt.Sprintf("%s:%s", m.config.DatabaseName, m.config.MigrationsTable)
if err != nil {
return err
}
Expand All @@ -180,7 +181,8 @@ func (m *Mysql) Unlock() error {
return nil
}

aid, err := database.GenerateAdvisoryLockId(m.config.DatabaseName)
aid, err := database.GenerateAdvisoryLockId(
fmt.Sprintf("%s:%s", m.config.DatabaseName, m.config.MigrationsTable)
if err != nil {
return err
}
Expand Down

0 comments on commit 5f2a8b7

Please sign in to comment.