This commit is contained in:
demoManito 2023-10-20 20:44:12 +08:00
parent e9c3b25552
commit 294255c11b
2 changed files with 4 additions and 2 deletions

View File

@ -241,7 +241,9 @@ func TestEmbeddedRelations(t *testing.T) {
Advanced bool
}
DB.Migrator().DropTable(&AdvancedUser{})
if err := DB.Migrator().DropTable(&AdvancedUser{}); err != nil {
t.Fatal(err)
}
if err := DB.AutoMigrate(&AdvancedUser{}); err != nil {
if DB.Dialector.Name() != "sqlite" {

View File

@ -62,7 +62,7 @@ func TestUpsert(t *testing.T) {
}
r := DB.Session(&gorm.Session{DryRun: true}).Clauses(clause.OnConflict{UpdateAll: true}).Create(&RestrictedLanguage{Code: "upsert_code", Name: "upsert_name", Lang: "upsert_lang"})
if !regexp.MustCompile(`INTO .restricted_languages. .*\(.code.,.name.,.lang.\) .* (SET|UPDATE) .name. = .*.name.\W*$`).MatchString(r.Statement.SQL.String()) {
if !regexp.MustCompile(`INTO .restricted_languages. .*\(.code.,.name.,.lang.\) .* (SET|UPDATE) .name.*=.*.name.\W*$`).MatchString(r.Statement.SQL.String()) {
t.Errorf("Table with escape character, got %v", r.Statement.SQL.String())
}
}