Skip to content

Commit

Permalink
Rename struct: Issue to AnalyzeSchemaIssue
Browse files Browse the repository at this point in the history
  • Loading branch information
sanyamsinghal committed Jan 2, 2025
1 parent 5fbfe90 commit a869cda
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions yb-voyager/cmd/analyzeSchema.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ const (

// Reports one case in JSON
func reportCase(filePath string, reason string, ghIssue string, suggestion string, objType string, objName string, sqlStmt string, issueType string, docsLink string) {
var issue utils.Issue
var issue utils.AnalyzeSchemaIssue
issue.FilePath = filePath
issue.Reason = reason
issue.GH = ghIssue
Expand Down Expand Up @@ -619,7 +619,7 @@ var MigrationCaveatsIssues = []string{
UNSUPPORTED_DATATYPE_LIVE_MIGRATION_WITH_FF_FB,
}

func convertIssueInstanceToAnalyzeIssue(issueInstance queryissue.QueryIssue, fileName string, isPlPgSQLIssue bool) utils.Issue {
func convertIssueInstanceToAnalyzeIssue(issueInstance queryissue.QueryIssue, fileName string, isPlPgSQLIssue bool) utils.AnalyzeSchemaIssue {
issueType := UNSUPPORTED_FEATURES
switch true {
case isPlPgSQLIssue:
Expand Down Expand Up @@ -669,7 +669,7 @@ func convertIssueInstanceToAnalyzeIssue(issueInstance queryissue.QueryIssue, fil

summaryMap[issueInstance.ObjectType].invalidCount[issueInstance.ObjectName] = true

return utils.Issue{
return utils.AnalyzeSchemaIssue{
IssueType: issueType,
ObjectType: issueInstance.ObjectType,
ObjectName: displayObjectName,
Expand Down Expand Up @@ -1074,7 +1074,7 @@ func analyzeSchemaInternal(sourceDBConf *srcdb.Source, detectIssues bool) utils.

// Ideally all filtering of issues should happen in queryissue pkg layer,
// but until we move all issue detection logic to queryissue pkg, we will filter issues here as well.
schemaAnalysisReport.Issues = lo.Filter(schemaAnalysisReport.Issues, func(i utils.Issue, index int) bool {
schemaAnalysisReport.Issues = lo.Filter(schemaAnalysisReport.Issues, func(i utils.AnalyzeSchemaIssue, index int) bool {
fixed, err := i.IsFixedIn(targetDbVersion)
if err != nil {
utils.ErrExit("checking if issue %v is supported: %v", i, err)
Expand Down Expand Up @@ -1238,7 +1238,7 @@ func packAndSendAnalyzeSchemaPayload(status string) {
payload := createCallhomePayload()

payload.MigrationPhase = ANALYZE_PHASE
var callhomeIssues []utils.Issue
var callhomeIssues []utils.AnalyzeSchemaIssue
for _, issue := range schemaAnalysisReport.Issues {
issue.SqlStatement = "" // Obfuscate sensitive information before sending to callhome cluster
if !lo.ContainsBy(reasonsToSendObjectNameToCallhome, func(r string) bool {
Expand Down
4 changes: 2 additions & 2 deletions yb-voyager/cmd/assessMigrationCommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -1119,10 +1119,10 @@ func fetchUnsupportedPlPgSQLObjects(schemaAnalysisReport utils.SchemaReport) []U
return nil
}
analyzeIssues := schemaAnalysisReport.Issues
plpgsqlIssues := lo.Filter(analyzeIssues, func(issue utils.Issue, _ int) bool {
plpgsqlIssues := lo.Filter(analyzeIssues, func(issue utils.AnalyzeSchemaIssue, _ int) bool {
return issue.IssueType == UNSUPPORTED_PLPGSQL_OBEJCTS
})
groupPlpgsqlIssuesByReason := lo.GroupBy(plpgsqlIssues, func(issue utils.Issue) string {
groupPlpgsqlIssuesByReason := lo.GroupBy(plpgsqlIssues, func(issue utils.AnalyzeSchemaIssue) string {
return issue.Reason
})
var unsupportedPlpgSqlObjects []UnsupportedFeature
Expand Down
2 changes: 1 addition & 1 deletion yb-voyager/cmd/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ type AssessMigrationPayload struct {
AssessmentIssues []AssessmentIssueYugabyteD
SourceSizeDetails SourceDBSizeDetails
TargetRecommendations TargetSizingRecommendations
ConversionIssues []utils.Issue
ConversionIssues []utils.AnalyzeSchemaIssue
// Depreacted: AssessmentJsonReport is depricated; use the fields directly inside struct
AssessmentJsonReport AssessmentReport
}
Expand Down
6 changes: 3 additions & 3 deletions yb-voyager/src/utils/commonVariables.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ type SchemaReport struct {
TargetDBVersion *ybversion.YBVersion `json:"TargetDBVersion"`
MigrationComplexity string `json:"MigrationComplexity"`
SchemaSummary SchemaSummary `json:"Summary"`
Issues []Issue `json:"Issues"`
Issues []AnalyzeSchemaIssue `json:"Issues"`
}

type SchemaSummary struct {
Expand All @@ -100,7 +100,7 @@ type DBObject struct {
}

// TODO: support MinimumVersionsFixedIn in xml
type Issue struct {
type AnalyzeSchemaIssue struct {
// TODO: rename IssueType to Category
IssueType string `json:"IssueType"` //category: unsupported_features, unsupported_plpgsql_objects, etc
ObjectType string `json:"ObjectType"`
Expand All @@ -115,7 +115,7 @@ type Issue struct {
MinimumVersionsFixedIn map[string]*ybversion.YBVersion `json:"MinimumVersionsFixedIn" xml:"-"` // key: series (2024.1, 2.21, etc)
}

func (i Issue) IsFixedIn(v *ybversion.YBVersion) (bool, error) {
func (i AnalyzeSchemaIssue) IsFixedIn(v *ybversion.YBVersion) (bool, error) {
if i.MinimumVersionsFixedIn == nil {
return false, nil
}
Expand Down

0 comments on commit a869cda

Please sign in to comment.