-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Analysis archiving #493
Merged
Merged
✨ Analysis archiving #493
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
80c52b8
checkpoint
jortel b5621df
checkpoint
jortel f1260f8
checkpoint
jortel 7dcfe76
checkpoint
jortel 139ab4a
checkpoint
jortel 0ac974b
checkpoint
jortel 4e15fcd
checkpoint
jortel 72f4be8
checkpoint
jortel aedbfbe
checkpoint
jortel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package v10 | ||
|
||
import ( | ||
"github.com/jortel/go-utils/logr" | ||
"github.com/konveyor/tackle2-hub/migration/v10/model" | ||
"gorm.io/gorm" | ||
) | ||
|
||
var log = logr.WithName("migration|v9") | ||
|
||
type Migration struct{} | ||
|
||
func (r Migration) Apply(db *gorm.DB) (err error) { | ||
err = db.AutoMigrate(r.Models()...) | ||
return | ||
} | ||
|
||
func (r Migration) Models() []interface{} { | ||
return model.All() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package model | ||
|
||
// | ||
// Analysis report. | ||
type Analysis struct { | ||
Model | ||
Effort int | ||
Archived bool `json:"archived"` | ||
Summary JSON `gorm:"type:json"` | ||
Issues []Issue `gorm:"constraint:OnDelete:CASCADE"` | ||
Dependencies []TechDependency `gorm:"constraint:OnDelete:CASCADE"` | ||
ApplicationID uint `gorm:"index;not null"` | ||
Application *Application | ||
} | ||
|
||
// | ||
// TechDependency report dependency. | ||
type TechDependency struct { | ||
Model | ||
Provider string `gorm:"uniqueIndex:depA"` | ||
Name string `gorm:"uniqueIndex:depA"` | ||
Version string `gorm:"uniqueIndex:depA"` | ||
SHA string `gorm:"uniqueIndex:depA"` | ||
Indirect bool | ||
Labels JSON `gorm:"type:json"` | ||
AnalysisID uint `gorm:"index;uniqueIndex:depA;not null"` | ||
Analysis *Analysis | ||
} | ||
|
||
// | ||
// Issue report issue (violation). | ||
type Issue struct { | ||
Model | ||
RuleSet string `gorm:"uniqueIndex:issueA;not null"` | ||
Rule string `gorm:"uniqueIndex:issueA;not null"` | ||
Name string `gorm:"index"` | ||
Description string | ||
Category string `gorm:"index;not null"` | ||
Incidents []Incident `gorm:"foreignKey:IssueID;constraint:OnDelete:CASCADE"` | ||
Links JSON `gorm:"type:json"` | ||
Facts JSON `gorm:"type:json"` | ||
Labels JSON `gorm:"type:json"` | ||
Effort int `gorm:"index;not null"` | ||
AnalysisID uint `gorm:"index;uniqueIndex:issueA;not null"` | ||
Analysis *Analysis | ||
} | ||
|
||
// | ||
// Incident report an issue incident. | ||
type Incident struct { | ||
Model | ||
File string `gorm:"index;not null"` | ||
Line int | ||
Message string | ||
CodeSnip string | ||
Facts JSON `gorm:"type:json"` | ||
IssueID uint `gorm:"index;not null"` | ||
Issue *Issue | ||
} | ||
|
||
// | ||
// Link URL link. | ||
type Link struct { | ||
URL string `json:"url"` | ||
Title string `json:"title,omitempty"` | ||
} | ||
|
||
// | ||
// ArchivedAIssue resource created when issues are archived. | ||
type ArchivedAIssue struct { | ||
RuleSet string `json:"ruleSet"` | ||
Rule string `json:"rule"` | ||
Name string `json:"name,omitempty" yaml:",omitempty"` | ||
Description string `json:"description,omitempty" yaml:",omitempty"` | ||
Category string `json:"category"` | ||
Effort int `json:"effort"` | ||
Incidents int `json:"incidents"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package model | ||
|
||
import "github.com/konveyor/tackle2-hub/migration/v9/model" | ||
|
||
// | ||
// JSON field (data) type. | ||
type JSON = []byte | ||
|
||
type Model = model.Model | ||
type Application = model.Application | ||
type Archetype = model.Archetype | ||
type Assessment = model.Assessment | ||
type Bucket = model.Bucket | ||
type BucketOwner = model.BucketOwner | ||
type BusinessService = model.BusinessService | ||
type Dependency = model.Dependency | ||
type File = model.File | ||
type Fact = model.Fact | ||
type Identity = model.Identity | ||
type Import = model.Import | ||
type ImportSummary = model.ImportSummary | ||
type ImportTag = model.ImportTag | ||
type JobFunction = model.JobFunction | ||
type MigrationWave = model.MigrationWave | ||
type Proxy = model.Proxy | ||
type Questionnaire = model.Questionnaire | ||
type Review = model.Review | ||
type Setting = model.Setting | ||
type RuleSet = model.RuleSet | ||
type Rule = model.Rule | ||
type Stakeholder = model.Stakeholder | ||
type StakeholderGroup = model.StakeholderGroup | ||
type Tag = model.Tag | ||
type TagCategory = model.TagCategory | ||
type Target = model.Target | ||
type Task = model.Task | ||
type TaskGroup = model.TaskGroup | ||
type TaskReport = model.TaskReport | ||
type Ticket = model.Ticket | ||
type Tracker = model.Tracker | ||
type TTL = model.TTL | ||
type ApplicationTag = model.ApplicationTag | ||
type DependencyCyclicError = model.DependencyCyclicError | ||
|
||
// | ||
// All builds all models. | ||
// Models are enumerated such that each are listed after | ||
// all the other models on which they may depend. | ||
func All() []interface{} { | ||
return []interface{}{ | ||
Application{}, | ||
TechDependency{}, | ||
Incident{}, | ||
Analysis{}, | ||
Issue{}, | ||
Bucket{}, | ||
BusinessService{}, | ||
Dependency{}, | ||
File{}, | ||
Fact{}, | ||
Identity{}, | ||
Import{}, | ||
ImportSummary{}, | ||
ImportTag{}, | ||
JobFunction{}, | ||
MigrationWave{}, | ||
Proxy{}, | ||
Review{}, | ||
Setting{}, | ||
RuleSet{}, | ||
Rule{}, | ||
Stakeholder{}, | ||
StakeholderGroup{}, | ||
Tag{}, | ||
TagCategory{}, | ||
Target{}, | ||
Task{}, | ||
TaskGroup{}, | ||
TaskReport{}, | ||
Ticket{}, | ||
Tracker{}, | ||
ApplicationTag{}, | ||
Questionnaire{}, | ||
Assessment{}, | ||
Archetype{}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the A in the middle of this name a typo? It doesn't match how it's aliased elsewhere.