From 9b714d07f5854b56a044167a2030596e2f94f3e9 Mon Sep 17 00:00:00 2001 From: Ather Shu Date: Tue, 6 Feb 2024 15:15:52 +0800 Subject: [PATCH] feat: dryrun migration should only print not-select sqls --- migrator/migrator.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/migrator/migrator.go b/migrator/migrator.go index d97fbf35..fb71faa0 100644 --- a/migrator/migrator.go +++ b/migrator/migrator.go @@ -47,7 +47,9 @@ type printSQLLogger struct { func (l *printSQLLogger) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error) { sql, _ := fc() - fmt.Println(sql + ";") + if len(sql) < 6 || strings.ToUpper(sql[0:6]) != "SELECT" { + fmt.Println(sql + ";") + } l.Interface.Trace(ctx, begin, fc, err) }