Skip to content

Commit

Permalink
cmd/atlas/internal: add file change to report (#2654)
Browse files Browse the repository at this point in the history
* cmd/atlas/internal: add file change to report

* fix test
  • Loading branch information
noamcattan authored Apr 1, 2024
1 parent 195553c commit c5646ad
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/atlas/internal/migratelint/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ type (
TotalFiles int `json:"-"` // Total number of files to analyze.
}

// FileChange specifies whether the file was added, deleted or changed.
FileChange string

// StepReport contains a summary of the analysis of a single step.
StepReport struct {
Name string `json:"Name,omitempty"` // Step name.
Expand All @@ -346,6 +349,7 @@ type (
Text string `json:"Text,omitempty"` // Contents of the file.
Reports []sqlcheck.Report `json:"Reports,omitempty"` // List of reports.
Error string `json:"Error,omitempty"` // File specific error.
Change FileChange `json:"Change,omitempty"` // Change of the file.

// Logging only info.
Start time.Time `json:"-"` // Start time of the analysis.
Expand All @@ -369,6 +373,12 @@ type (
SilentError struct{ error }
)

const (
FileChangeAdded FileChange = "ADDED"
FileChangeDeleted FileChange = "DELETED"
FileChangeModified FileChange = "MODIFIED"
)

// NewSummaryReport returns a new SummaryReport.
func NewSummaryReport(c *sqlclient.Client, dir migrate.Dir) *SummaryReport {
sum := &SummaryReport{
Expand Down

0 comments on commit c5646ad

Please sign in to comment.