From a388744d58fe81edb147e2ddcb9f7800268911ba Mon Sep 17 00:00:00 2001 From: bigxu Date: Thu, 14 May 2020 16:46:07 +0800 Subject: [PATCH] Fiexed:set ms.IgnoreUnknown true when length sqlFile is not 0 --- migrate.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/migrate.go b/migrate.go index a4ef791c..2da5d0a5 100644 --- a/migrate.go +++ b/migrate.go @@ -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{}{}