Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Directive ¶
type Directive struct {
Type DirectiveType `json:"type"` // DirectiveTypeWait, etc.
Message string `json:"message"` // Auto-generated descriptive message
}
Directive represents a special directive for execution (wait, assert, etc.)
type DirectiveType ¶
type DirectiveType string
DirectiveType represents the different types of directives
const (
DirectiveTypeWait DirectiveType = "wait"
)
func (DirectiveType) String ¶
func (dt DirectiveType) String() string
String returns the string representation of DirectiveType
type ExecutionGroup ¶
type ExecutionGroup struct {
Steps []Step `json:"steps"`
}
ExecutionGroup represents a group of steps that should be executed together
type Plan ¶
type Plan struct {
// Version information
Version string `json:"version"`
PgschemaVersion string `json:"pgschema_version"`
// When the plan was created
CreatedAt time.Time `json:"created_at"`
// Source database fingerprint when plan was created
SourceFingerprint *fingerprint.SchemaFingerprint `json:"source_fingerprint,omitempty"`
// Groups is the ordered list of execution groups
Groups []ExecutionGroup `json:"groups"`
// SourceDiffs stores original diff information for summary calculation
// This field is only serialized in debug mode
SourceDiffs []diff.Diff `json:"source_diffs,omitempty"`
}
Plan represents the migration plan between two DDL states
func NewPlanWithFingerprint ¶
func NewPlanWithFingerprint(diffs []diff.Diff, sourceFingerprint *fingerprint.SchemaFingerprint) *Plan
NewPlanWithFingerprint creates a new plan from diffs and includes source fingerprint
func (*Plan) HasAnyChanges ¶
HasAnyChanges checks if the plan contains any changes by examining the groups
func (*Plan) HumanColored ¶
HumanColored returns a human-readable summary of the plan with color support
func (*Plan) ToJSONWithDebug ¶
ToJSONWithDebug returns the plan as structured JSON with optional source field inclusion
type PlanSummary ¶
type PlanSummary struct {
Total int `json:"total"`
Add int `json:"add"`
Change int `json:"change"`
Destroy int `json:"destroy"`
ByType map[string]TypeSummary `json:"by_type"`
}
PlanSummary provides counts of changes by type
type RewriteStep ¶
type RewriteStep struct {
SQL string `json:"sql,omitempty"`
CanRunInTransaction bool `json:"can_run_in_transaction"`
Directive *Directive `json:"directive,omitempty"`
}
RewriteStep represents a single step in a rewrite operation
type SQLFormat ¶
type SQLFormat string
SQLFormat represents the different output formats for SQL generation
type Step ¶
type Step struct {
SQL string `json:"sql"`
Directive *Directive `json:"directive,omitempty"`
// Metadata for summary generation
Type string `json:"type,omitempty"` // e.g., "table", "index"
Operation string `json:"operation,omitempty"` // e.g., "create", "alter", "drop"
Path string `json:"path,omitempty"` // e.g., "public.users"
}
Step represents a single execution step with SQL and optional directive
type Type ¶
type Type string
Type represents the database object types in dependency order
const ( TypeSchema Type = "schemas" TypeType Type = "types" TypeFunction Type = "functions" TypeProcedure Type = "procedures" TypeSequence Type = "sequences" TypeTable Type = "tables" TypeView Type = "views" TypeMaterializedView Type = "materialized views" TypeIndex Type = "indexes" TypeTrigger Type = "triggers" TypePolicy Type = "policies" TypeColumn Type = "columns" TypeRLS Type = "rls" TypeDefaultPrivilege Type = "default privileges" TypePrivilege Type = "privileges" TypeColumnPrivilege Type = "column privileges" TypeRevokedDefaultPrivilege Type = "revoked default privileges" )
type TypeSummary ¶
type TypeSummary struct {
Add int `json:"add"`
Change int `json:"change"`
Destroy int `json:"destroy"`
}
TypeSummary provides counts for a specific object type