-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test: TestAutoMigrateInt8PG: shouldn't execute ALTER COLUMN TYPE …
…smallint, close #5762
- Loading branch information
1 parent
a0f4d3f
commit 62593cf
Showing
3 changed files
with
99 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package tests_test | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
"gorm.io/gorm/logger" | ||
) | ||
|
||
type Tracer struct { | ||
Logger logger.Interface | ||
Test func(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error) | ||
} | ||
|
||
func (S Tracer) LogMode(level logger.LogLevel) logger.Interface { | ||
return S.Logger.LogMode(level) | ||
} | ||
|
||
func (S Tracer) Info(ctx context.Context, s string, i ...interface{}) { | ||
S.Logger.Info(ctx, s, i...) | ||
} | ||
|
||
func (S Tracer) Warn(ctx context.Context, s string, i ...interface{}) { | ||
S.Logger.Warn(ctx, s, i...) | ||
} | ||
|
||
func (S Tracer) Error(ctx context.Context, s string, i ...interface{}) { | ||
S.Logger.Error(ctx, s, i...) | ||
} | ||
|
||
func (S Tracer) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error) { | ||
S.Logger.Trace(ctx, begin, fc, err) | ||
S.Test(ctx, begin, fc, err) | ||
} |