Documentation
¶
Index ¶
- func AreDefaultsEqual(default1, default2 string) bool
- func FindCycle[T CycleNode](remaining []T, graph CycleGraph[T]) string
- func FunctionKey(schema, name string, argTypes []string) string
- func IndexKey(schema, name string) string
- func IndexUsesColumn(idx *schema.Index, tableName, columnName string) bool
- func NewViewNormalizer() *viewNormalizer
- func NormalizeDataType(dataType string) string
- func NormalizeViewDefinition(definition string) string
- func PartitionKey(tableSchema, tableName, partitionName string) string
- func TableKey(schema, name string) string
- func ViewKey(schema, name string) string
- type Change
- type ChangeSeverity
- type ChangeType
- type ColumnComparator
- type ConstraintComparator
- type CycleGraph
- type CycleNode
- type DiffResult
- type DiffStats
- type Differ
- type FunctionComparator
- type IndexComparator
- type Options
- type TableComparator
- type TriggerComparator
- type ViewComparator
- func (vc *ViewComparator) AreEqual(current, desired schema.View) bool
- func (vc *ViewComparator) CreateAddChange(key string, view schema.View) Change
- func (vc *ViewComparator) CreateCommentChange(key string, view schema.View, oldComment, newComment string) Change
- func (vc *ViewComparator) CreateDropChange(key string, view schema.View) Change
- func (vc *ViewComparator) CreateModifyChange(key string, current, desired schema.View) Change
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreDefaultsEqual ¶
func FindCycle ¶
func FindCycle[T CycleNode]( remaining []T, graph CycleGraph[T], ) string
func FunctionKey ¶
func IndexUsesColumn ¶ added in v0.8.25
IndexUsesColumn reports whether an index references a table column in its key expressions, included columns, or partial-index predicate.
func NewViewNormalizer ¶
func NewViewNormalizer() *viewNormalizer
func NormalizeDataType ¶
func NormalizeViewDefinition ¶
func PartitionKey ¶ added in v0.3.0
Types ¶
type Change ¶
type Change struct {
Type ChangeType
Severity ChangeSeverity
Description string
ObjectType string
ObjectName string
Details map[string]any
DependsOn []string
Order int
}
type ChangeSeverity ¶
type ChangeSeverity string
const ( SeveritySafe ChangeSeverity = "SAFE" SeverityPotentiallyBreaking ChangeSeverity = "POTENTIALLY_BREAKING" SeverityBreaking ChangeSeverity = "BREAKING" SeverityDataMigrationRequired ChangeSeverity = "DATA_MIGRATION_REQUIRED" )
type ChangeType ¶
type ChangeType string
const ( ChangeTypeAddSchema ChangeType = "ADD_SCHEMA" ChangeTypeDropSchema ChangeType = "DROP_SCHEMA" ChangeTypeAddTable ChangeType = "ADD_TABLE" ChangeTypeDropTable ChangeType = "DROP_TABLE" ChangeTypeModifyTableComment ChangeType = "MODIFY_TABLE_COMMENT" ChangeTypeAddView ChangeType = "ADD_VIEW" ChangeTypeDropView ChangeType = "DROP_VIEW" ChangeTypeModifyView ChangeType = "MODIFY_VIEW" ChangeTypeAddMaterializedView ChangeType = "ADD_MATERIALIZED_VIEW" ChangeTypeDropMaterializedView ChangeType = "DROP_MATERIALIZED_VIEW" ChangeTypeModifyMaterializedView ChangeType = "MODIFY_MATERIALIZED_VIEW" ChangeTypeAddFunction ChangeType = "ADD_FUNCTION" ChangeTypeDropFunction ChangeType = "DROP_FUNCTION" ChangeTypeModifyFunction ChangeType = "MODIFY_FUNCTION" ChangeTypeAddTrigger ChangeType = "ADD_TRIGGER" ChangeTypeDropTrigger ChangeType = "DROP_TRIGGER" ChangeTypeModifyTrigger ChangeType = "MODIFY_TRIGGER" ChangeTypeAddExtension ChangeType = "ADD_EXTENSION" ChangeTypeDropExtension ChangeType = "DROP_EXTENSION" ChangeTypeModifyExtension ChangeType = "MODIFY_EXTENSION" ChangeTypeAddSequence ChangeType = "ADD_SEQUENCE" ChangeTypeDropSequence ChangeType = "DROP_SEQUENCE" ChangeTypeModifySequence ChangeType = "MODIFY_SEQUENCE" ChangeTypeAddCustomType ChangeType = "ADD_CUSTOM_TYPE" ChangeTypeDropCustomType ChangeType = "DROP_CUSTOM_TYPE" ChangeTypeModifyCustomType ChangeType = "MODIFY_CUSTOM_TYPE" ChangeTypeAddColumn ChangeType = "ADD_COLUMN" ChangeTypeDropColumn ChangeType = "DROP_COLUMN" ChangeTypeModifyColumnType ChangeType = "MODIFY_COLUMN_TYPE" ChangeTypeModifyColumnNullability ChangeType = "MODIFY_COLUMN_NULLABILITY" ChangeTypeModifyColumnDefault ChangeType = "MODIFY_COLUMN_DEFAULT" ChangeTypeModifyColumnComment ChangeType = "MODIFY_COLUMN_COMMENT" ChangeTypeRenameColumn ChangeType = "RENAME_COLUMN" ChangeTypeAddConstraint ChangeType = "ADD_CONSTRAINT" ChangeTypeDropConstraint ChangeType = "DROP_CONSTRAINT" ChangeTypeModifyConstraint ChangeType = "MODIFY_CONSTRAINT" ChangeTypeAddIndex ChangeType = "ADD_INDEX" ChangeTypeDropIndex ChangeType = "DROP_INDEX" ChangeTypeModifyIndex ChangeType = "MODIFY_INDEX" ChangeTypeAddPartition ChangeType = "ADD_PARTITION" ChangeTypeDropPartition ChangeType = "DROP_PARTITION" ChangeTypeAddHypertable ChangeType = "ADD_HYPERTABLE" ChangeTypeDropHypertable ChangeType = "DROP_HYPERTABLE" ChangeTypeModifyHypertable ChangeType = "MODIFY_HYPERTABLE" ChangeTypeAddCompressionPolicy ChangeType = "ADD_COMPRESSION_POLICY" ChangeTypeDropCompressionPolicy ChangeType = "DROP_COMPRESSION_POLICY" ChangeTypeModifyCompressionPolicy ChangeType = "MODIFY_COMPRESSION_POLICY" ChangeTypeAddRetentionPolicy ChangeType = "ADD_RETENTION_POLICY" ChangeTypeDropRetentionPolicy ChangeType = "DROP_RETENTION_POLICY" ChangeTypeModifyRetentionPolicy ChangeType = "MODIFY_RETENTION_POLICY" ChangeTypeAddContinuousAggregate ChangeType = "ADD_CONTINUOUS_AGGREGATE" ChangeTypeDropContinuousAggregate ChangeType = "DROP_CONTINUOUS_AGGREGATE" ChangeTypeModifyContinuousAggregate ChangeType = "MODIFY_CONTINUOUS_AGGREGATE" )
type ColumnComparator ¶
type ColumnComparator struct {
// contains filtered or unexported fields
}
func NewColumnComparator ¶
func NewColumnComparator(opts *Options) *ColumnComparator
func (*ColumnComparator) Compare ¶
func (cc *ColumnComparator) Compare( result *DiffResult, tableKey string, currentTable *schema.Table, current, desired *schema.Table, )
type ConstraintComparator ¶
type ConstraintComparator struct {
// contains filtered or unexported fields
}
func NewConstraintComparator ¶
func NewConstraintComparator(opts *Options) *ConstraintComparator
func (*ConstraintComparator) Compare ¶
func (cc *ConstraintComparator) Compare(result *DiffResult, current, desired *schema.Table)
type CycleGraph ¶
type CycleNode ¶
type CycleNode interface {
comparable
}
type DiffResult ¶
type DiffResult struct {
Current *schema.Database
Desired *schema.Database
Changes []Change
Warnings []string
Stats DiffStats
}
func (*DiffResult) GetChangesBySeverity ¶
func (dr *DiffResult) GetChangesBySeverity(severity ChangeSeverity) []Change
func (*DiffResult) GetChangesByType ¶
func (dr *DiffResult) GetChangesByType(changeType ChangeType) []Change
func (*DiffResult) HasBreakingChanges ¶
func (dr *DiffResult) HasBreakingChanges() bool
func (*DiffResult) HasChanges ¶
func (dr *DiffResult) HasChanges() bool
func (*DiffResult) Summary ¶
func (dr *DiffResult) Summary() string
type DiffStats ¶
type DiffStats struct {
TablesAdded int
TablesDropped int
TablesModified int
ColumnsAdded int
ColumnsDropped int
ColumnsModified int
IndexesAdded int
IndexesDropped int
ConstraintsAdded int
ConstraintsDropped int
ViewsAdded int
ViewsDropped int
ViewsModified int
FunctionsAdded int
FunctionsDropped int
FunctionsModified int
}
type FunctionComparator ¶
type FunctionComparator struct {
// contains filtered or unexported fields
}
func NewFunctionComparator ¶
func NewFunctionComparator(opts *Options) *FunctionComparator
func (*FunctionComparator) Compare ¶
func (fc *FunctionComparator) Compare(result *DiffResult)
type IndexComparator ¶
type IndexComparator struct {
// contains filtered or unexported fields
}
func NewIndexComparator ¶
func NewIndexComparator(opts *Options) *IndexComparator
func (*IndexComparator) Compare ¶
func (ic *IndexComparator) Compare(result *DiffResult)
type Options ¶
type Options struct {
IgnoreComments bool
IgnoreOwners bool
IgnoreTablespaces bool
DetectRenames bool
IgnoreIndexNames bool
IgnoreConstraintNames bool
}
func DefaultOptions ¶
func DefaultOptions() *Options
type TableComparator ¶
type TableComparator struct {
// contains filtered or unexported fields
}
func NewTableComparator ¶
func NewTableComparator(opts *Options) *TableComparator
func (*TableComparator) Compare ¶
func (tc *TableComparator) Compare(result *DiffResult)
type TriggerComparator ¶
type TriggerComparator struct{}
func NewTriggerComparator ¶
func NewTriggerComparator() *TriggerComparator
func (*TriggerComparator) Compare ¶
func (tc *TriggerComparator) Compare(result *DiffResult)
type ViewComparator ¶
type ViewComparator struct {
// contains filtered or unexported fields
}
func NewViewComparator ¶
func NewViewComparator(opts *Options) *ViewComparator
func (*ViewComparator) AreEqual ¶
func (vc *ViewComparator) AreEqual(current, desired schema.View) bool
func (*ViewComparator) CreateAddChange ¶
func (vc *ViewComparator) CreateAddChange(key string, view schema.View) Change
func (*ViewComparator) CreateCommentChange ¶
func (*ViewComparator) CreateDropChange ¶
func (vc *ViewComparator) CreateDropChange(key string, view schema.View) Change
func (*ViewComparator) CreateModifyChange ¶
func (vc *ViewComparator) CreateModifyChange(key string, current, desired schema.View) Change
Source Files
¶
Click to show internal directories.
Click to hide internal directories.