@@ -210,15 +210,15 @@ func (m *Migrator) Migrate(ctx context.Context, opts ...MigrationOption) (*Migra
210210// RunMigration runs the up migration with the given ID without marking it as applied.
211211// It runs the migration even if it is already marked as applied.
212212func (m * Migrator ) RunMigration (
213- ctx context.Context , migrationID int64 , opts ... MigrationOption ,
213+ ctx context.Context , migrationName string , opts ... MigrationOption ,
214214) error {
215215 cfg := newMigrationConfig (opts )
216216
217217 if err := m .validate (); err != nil {
218218 return err
219219 }
220- if migrationID == 0 {
221- return errors .New ("migrate: migration id must be greater than zero " )
220+ if migrationName == "" {
221+ return errors .New ("migrate: migration name cannot be empty " )
222222 }
223223
224224 migrations , _ , err := m .migrationsWithStatus (ctx )
@@ -228,13 +228,13 @@ func (m *Migrator) RunMigration(
228228
229229 var migration * Migration
230230 for i := range migrations {
231- if migrations [i ].ID == migrationID {
231+ if migrations [i ].Name == migrationName {
232232 migration = & migrations [i ]
233233 break
234234 }
235235 }
236236 if migration == nil {
237- return fmt .Errorf ("migrate: migration with id %d not found" , migrationID )
237+ return fmt .Errorf ("migrate: migration with name %q not found" , migrationName )
238238 }
239239 if migration .Up == nil {
240240 return fmt .Errorf ("migrate: migration %s does not have up migration" , migration .Name )
0 commit comments