Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Skip database schema drift anomaly if the migration schema is not ready

天舟901511968d55
diff --git a/server/anomaly_scanner.go b/server/anomaly_scanner.go
index 7a92e18fe4..c07c3570b0 100644
--- a/server/anomaly_scanner.go
+++ b/server/anomaly_scanner.go
@@ -271,6 +271,19 @@ func (s *AnomalyScanner) checkDatabaseAnomaly(ctx context.Context, instance *api
// Check schema drift
{
+ setup, err := driver.NeedsSetupMigration(ctx)
+ if err != nil {
+ s.l.Debug("Failed to check anomaly",
+ zap.String("instance", instance.Name),
+ zap.String("database", database.Name),
+ zap.String("type", string(api.AnomalyDatabaseSchemaDrift)),
+ zap.Error(err))
+ goto SchemaDriftEnd
+ }
+ // Skip drift check if migration schema is not ready (we have instance anomaly to cover that)
+ if setup {
+ goto SchemaDriftEnd
+ }
var schemaBuf bytes.Buffer
if err := driver.Dump(ctx, database.Name, &schemaBuf, true /*schemaOnly*/); err != nil {
if common.ErrorCode(err) == common.NotFound {