优化
This commit is contained in:
@@ -19,6 +19,12 @@ func openDataScopeAuditTestDB(t *testing.T, name string) *gorm.DB {
|
||||
if err = db.AutoMigrate(&dataAccessLogPO{}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// The in-memory SQLite URI is intentionally named so the audit writer can
|
||||
// use a second GORM handle. Clear rows left by a prior -count iteration so
|
||||
// each test starts with an isolated logical database.
|
||||
if err = db.Unscoped().Where("1 = 1").Delete(&dataAccessLogPO{}).Error; err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return db
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user