Skip to content

Commit

Permalink
minor refactoring to analyze schema issue struct
Browse files Browse the repository at this point in the history
  • Loading branch information
sanyamsinghal committed Jan 14, 2025
1 parent 14ca806 commit 517ef84
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
23 changes: 11 additions & 12 deletions yb-voyager/cmd/analyzeSchema.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,18 +222,17 @@ const (

// Reports one case in JSON
func reportCase(filePath string, reason string, ghIssue string, suggestion string, objType string, objName string, sqlStmt string, category string, docsLink string, impact string) {
var issue utils.AnalyzeSchemaIssue
issue.FilePath = filePath
issue.Reason = reason
issue.GH = ghIssue
issue.Suggestion = suggestion
issue.ObjectType = objType
issue.ObjectName = objName
issue.SqlStatement = sqlStmt
issue.IssueType = category // IssueType field of analyze schema should be renamed to Category
issue.Impact = lo.Ternary(impact != "", impact, constants.IMPACT_LEVEL_1)
if sourceDBType == POSTGRESQL {
issue.DocsLink = docsLink
issue := utils.AnalyzeSchemaIssue{
IssueType: category, // TODO: to be replaced with Category as a field
Reason: reason,
Impact: lo.Ternary(impact != "", impact, constants.IMPACT_LEVEL_1),
ObjectType: objType,
ObjectName: objName,
SqlStatement: sqlStmt,
FilePath: filePath,
Suggestion: suggestion,
GH: ghIssue,
DocsLink: docsLink,
}

schemaAnalysisReport.Issues = append(schemaAnalysisReport.Issues, issue)
Expand Down
2 changes: 1 addition & 1 deletion yb-voyager/src/query/queryissue/issues_ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var generatedColumnsIssue = issue.Issue{
Name: "Stored generated columns are not supported.",
Impact: constants.IMPACT_LEVEL_1,
GH: "https://github.com/yugabyte/yugabyte-db/issues/10695",
Suggestion: "Use Triggers to update the generated columns is one way to work around this issue, refer docs link for more details.",
Suggestion: "Using Triggers to update the generated columns is one way to work around this issue, refer docs link for more details.",
DocsLink: "https://docs.yugabyte.com/preview/yugabyte-voyager/known-issues/postgresql/#generated-always-as-stored-type-column-is-not-supported",
}

Expand Down
8 changes: 4 additions & 4 deletions yb-voyager/src/utils/commonVariables.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ type DBObject struct {

// TODO: support MinimumVersionsFixedIn in xml
type AnalyzeSchemaIssue struct {
// TODO: rename IssueType to Category
// TODO: deprecate this and rename to Category
IssueType string `json:"IssueType"` //category: unsupported_features, unsupported_plpgsql_objects, etc
ObjectType string `json:"ObjectType"`
ObjectName string `json:"ObjectName"`
Reason string `json:"Reason"`
Type string `json:"-" xml:"-"` // identifier for issue type ADVISORY_LOCKS, SYSTEM_COLUMNS, etc
Reason string `json:"Reason"`
Impact string `json:"-" xml:"-"` // temporary field; since currently we generate assessment issue from analyze issue
ObjectType string `json:"ObjectType"`
ObjectName string `json:"ObjectName"`
SqlStatement string `json:"SqlStatement,omitempty"`
FilePath string `json:"FilePath"`
Suggestion string `json:"Suggestion"`
Expand Down

0 comments on commit 517ef84

Please sign in to comment.