Skip to content

Commit

Permalink
Fiexed:set ms.IgnoreUnknown true when length sqlFile is not 0
Browse files Browse the repository at this point in the history
  • Loading branch information
bigxu committed May 14, 2020
1 parent ed87383 commit a388744
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,8 @@ func (ms MigrationSet) PlanMigration(db *sql.DB, dialect string, m MigrationSour

// Make sure all migrations in the database are among the found migrations which
// are to be applied.
if !ms.IgnoreUnknown {
// patch for special sql file: len(sqlFiles) == 0
if !ms.IgnoreUnknown && len(sqlFiles) == 0 {
migrationsSearch := make(map[string]struct{})
for _, migration := range migrations {
migrationsSearch[migration.Id] = struct{}{}
Expand Down

0 comments on commit a388744

Please sign in to comment.