Skip to content

Commit 43c593f

Browse files
committed
check empty lines in migration files for mysql
1 parent 6fb8f98 commit 43c593f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

adapter/migrator.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@ func (m *Migrator) RunMigration(mg *Migration) error {
4949
sql := string(f)
5050

5151
for _, line := range strings.Split(sql, "\n") {
52-
_, err = m.Adapter.ExecContext(context.Background(), line)
53-
if err != nil {
54-
return fmt.Errorf("migration error: %v", err)
52+
line = strings.TrimSpace(line)
53+
if line != "" {
54+
_, err = m.Adapter.ExecContext(context.Background(), line)
55+
if err != nil {
56+
return fmt.Errorf("migration error: %v", err)
57+
}
5558
}
5659
}
5760

0 commit comments

Comments
 (0)