@@ -111,7 +111,7 @@ type Migrator struct {
111111 // The names of migrations that need the hash repaired.
112112 repair map [string ]string
113113 // Set of added migrations
114- names map [string ]bool
114+ names map [string ]struct {}
115115 // The query runner for the db.
116116 backend backends.Backend
117117 // The SQL 'table_schema' in Postgres this is typically 'public' in MySQL
@@ -145,11 +145,11 @@ func (m *Migrator) UseBackend(key string) error {
145145// An error is returned if a migration with the same name has already been
146146// added.
147147func (m * Migrator ) AddMigration (name string , comment string , statement string , args ... interface {}) error {
148- if m .names [name ] {
148+ if _ , ok := m .names [name ]; ok {
149149 return fmt .Errorf ("migration '%s' alraedy exists" , name )
150150 }
151151 // Add name to set
152- m .names [name ] = true
152+ m .names [name ] = struct {}{}
153153
154154 // Create the new migration
155155 mig := Migration {
@@ -390,7 +390,7 @@ func New(db *sqlx.DB, tableName string, tableSchema string) (Migrator, error) {
390390 previous : make (map [string ]string ),
391391 migrations : make ([]Migration , 0 , 1 ),
392392 repair : make (map [string ]string ),
393- names : make (map [string ]bool ),
393+ names : make (map [string ]struct {} ),
394394 }
395395 b := BackendType (db .DriverName ())
396396 err := m .UseBackend (b )
0 commit comments