Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: add details member for advice (#5302)
rebelice7862289c5367
diff --git a/backend/legacyapi/task_check_run.go b/backend/legacyapi/task_check_run.goindex f4c5fecd72..d2d3255d0a 100644--- a/backend/legacyapi/task_check_run.go+++ b/backend/legacyapi/task_check_run.go@@ -102,6 +102,7 @@ type TaskCheckResult struct {Title string `json:"title,omitempty"`Content string `json:"content,omitempty"`Line int `json:"line,omitempty"`+ Details string `json:"details,omitempty"`}// TaskCheckRunResultPayload is the result payload of a task check run.diff --git a/backend/plugin/advisor/advisor.go b/backend/plugin/advisor/advisor.goindex 860e8fd809..112cf449ef 100644--- a/backend/plugin/advisor/advisor.go+++ b/backend/plugin/advisor/advisor.go@@ -330,6 +330,7 @@ type Advice struct {Title string `json:"title"`Content string `json:"content"`Line int `json:"line"`+ Details string `json:"details,omitempty"`}// MarshalLogObject constructs a field that carries Advice.@@ -339,6 +340,7 @@ func (a Advice) MarshalLogObject(enc zapcore.ObjectEncoder) error {enc.AddString("title", a.Title)enc.AddString("content", a.Content)enc.AddInt("line", a.Line)+ enc.AddString("details", a.Details)return nil}diff --git a/backend/plugin/advisor/sql_review.go b/backend/plugin/advisor/sql_review.goindex e673da51b1..e9e573fe88 100644--- a/backend/plugin/advisor/sql_review.go+++ b/backend/plugin/advisor/sql_review.go@@ -646,7 +646,7 @@ func convertWalkThroughErrorToAdvice(checkContext SQLReviewCheckContext, err errLine: walkThroughError.Line,})case catalog.ErrorTypeColumnIsReferencedByView:- content := walkThroughError.Content+ details := ""if checkContext.DbType == db.Postgres {list, yes := walkThroughError.Payload.([]string)if !yes {@@ -655,7 +655,7 @@ func convertWalkThroughErrorToAdvice(checkContext SQLReviewCheckContext, err errif definition, err := getViewDefinition(checkContext, list); err != nil {log.Warn("failed to get view definition", zap.Error(err))} else {- content = fmt.Sprintf("%s\n\n%s", content, definition)+ details = definition}}@@ -663,11 +663,12 @@ func convertWalkThroughErrorToAdvice(checkContext SQLReviewCheckContext, err errStatus: Error,Code: ColumnIsReferencedByView,Title: "Column is referenced by view",- Content: content,+ Content: walkThroughError.Content,Line: walkThroughError.Line,+ Details: details,})case catalog.ErrorTypeTableIsReferencedByView:- content := walkThroughError.Content+ details := ""if checkContext.DbType == db.Postgres {list, yes := walkThroughError.Payload.([]string)if !yes {@@ -676,7 +677,7 @@ func convertWalkThroughErrorToAdvice(checkContext SQLReviewCheckContext, err errif definition, err := getViewDefinition(checkContext, list); err != nil {log.Warn("failed to get view definition", zap.Error(err))} else {- content = fmt.Sprintf("%s\n\n%s", content, definition)+ details = definition}}@@ -684,8 +685,9 @@ func convertWalkThroughErrorToAdvice(checkContext SQLReviewCheckContext, err errStatus: Error,Code: TableIsReferencedByView,Title: "Table is referenced by view",- Content: content,+ Content: walkThroughError.Content,Line: walkThroughError.Line,+ Details: details,})default:res = append(res, Advice{diff --git a/backend/runner/taskcheck/statement_advisor_composite_executor.go b/backend/runner/taskcheck/statement_advisor_composite_executor.goindex f57132a9d6..33dac887ea 100644--- a/backend/runner/taskcheck/statement_advisor_composite_executor.go+++ b/backend/runner/taskcheck/statement_advisor_composite_executor.go@@ -145,6 +145,7 @@ func (e *StatementAdvisorCompositeExecutor) Run(ctx context.Context, taskCheckRuTitle: advice.Title,Content: advice.Content,Line: advice.Line,+ Details: advice.Details,})}@@ -156,6 +157,7 @@ func (e *StatementAdvisorCompositeExecutor) Run(ctx context.Context, taskCheckRuTitle: "OK",Content: "",Line: 0,+ Details: "",})}diff --git a/backend/runner/taskcheck/statement_advisor_simple_executor.go b/backend/runner/taskcheck/statement_advisor_simple_executor.goindex ab82f48290..15b5a82ee0 100644--- a/backend/runner/taskcheck/statement_advisor_simple_executor.go+++ b/backend/runner/taskcheck/statement_advisor_simple_executor.go@@ -107,6 +107,7 @@ func (e *StatementAdvisorSimpleExecutor) Run(ctx context.Context, taskCheckRun *Title: advice.Title,Content: advice.Content,Line: advice.Line,+ Details: advice.Details,})}