Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: update the statement in the payload for creating database (#3578)
Danny Xud816b7ae71ce
diff --git a/server/task_executor_database_create.go b/server/task_executor_database_create.goindex cfefaf1f24..d418ac8a2b 100644--- a/server/task_executor_database_create.go+++ b/server/task_executor_database_create.go@@ -190,18 +190,24 @@ func (exec *DatabaseCreateTaskExecutor) RunOnce(ctx context.Context, server *Ser}// After the task related database entry created successfully,- // we need to update task's database_id with the newly created database immediately.+ // we need to update task's database_id and statement with the newly created database immediately.// Here is the main reason:// The task database_id represents its related database entry both for creating and patching,// so we should sync its value right here when the related database entry created.+ // The new statement should include the schema from peer tenant database.+ payload.Statement = statement+ bytes, err := json.Marshal(payload)+ if err != nil {+ return true, nil, errors.Wrap(err, "Failed to construct updated task payload")+ }+ payloadStr := string(bytes)taskDatabaseIDPatch := &api.TaskPatch{ID: task.ID,UpdaterID: api.SystemBotID,DatabaseID: &database.ID,- Statement: &statement,+ Payload: &payloadStr,}- _, err = server.store.PatchTask(ctx, taskDatabaseIDPatch)- if err != nil {+ if _, err = server.store.PatchTask(ctx, taskDatabaseIDPatch); err != nil {return true, nil, err}