feat: include SQL scripts in schema diff
This commit is contained in:
@@ -22,6 +22,7 @@ type SchemaChange struct {
|
||||
Tables *TableDiff `json:"tables,omitempty"`
|
||||
Views *ViewDiff `json:"views,omitempty"`
|
||||
Sequences *SequenceDiff `json:"sequences,omitempty"`
|
||||
Scripts *ScriptDiff `json:"scripts,omitempty"`
|
||||
}
|
||||
|
||||
// TableDiff represents differences in tables
|
||||
@@ -131,6 +132,21 @@ type SequenceChange struct {
|
||||
Changes map[string]any `json:"changes"`
|
||||
}
|
||||
|
||||
// ScriptDiff represents differences in migration scripts.
|
||||
type ScriptDiff struct {
|
||||
Missing []*models.Script `json:"missing"` // Scripts in source but not in target
|
||||
Extra []*models.Script `json:"extra"` // Scripts in target but not in source
|
||||
Modified []*ScriptChange `json:"modified"` // Scripts that exist in both but differ
|
||||
}
|
||||
|
||||
// ScriptChange represents a modified migration script.
|
||||
type ScriptChange struct {
|
||||
Name string `json:"name"`
|
||||
Source *models.Script `json:"source"`
|
||||
Target *models.Script `json:"target"`
|
||||
Changes map[string]any `json:"changes"`
|
||||
}
|
||||
|
||||
// Summary provides counts for quick overview
|
||||
type Summary struct {
|
||||
Schemas SchemaSummary `json:"schemas"`
|
||||
@@ -141,6 +157,7 @@ type Summary struct {
|
||||
Relationships RelationshipSummary `json:"relationships"`
|
||||
Views ViewSummary `json:"views"`
|
||||
Sequences SequenceSummary `json:"sequences"`
|
||||
Scripts ScriptSummary `json:"scripts"`
|
||||
}
|
||||
|
||||
type SchemaSummary struct {
|
||||
@@ -190,3 +207,9 @@ type SequenceSummary struct {
|
||||
Extra int `json:"extra"`
|
||||
Modified int `json:"modified"`
|
||||
}
|
||||
|
||||
type ScriptSummary struct {
|
||||
Missing int `json:"missing"`
|
||||
Extra int `json:"extra"`
|
||||
Modified int `json:"modified"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user