Documentation
¶
Overview ¶
Package diff provides schema comparison and migration generation
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
func Apply(db *sql.DB, schemaDir string, opts ApplyOptions) error
Apply applies schema changes to a database
func GenerateSQL ¶
GenerateSQL generates a complete migration script
func HasDestructive ¶
HasDestructive returns true if any changes are destructive
Types ¶
type ApplyOptions ¶
type ApplyOptions struct {
DryRun bool
SkipDestructive bool
BackupPath string // Path to create backup (empty = no backup)
}
ApplyOptions configures how changes are applied
type Change ¶
type Change struct {
Type ChangeType
Object string // Name of the object being changed
Description string // Human-readable description
SQL []string // SQL statements to apply
Destructive bool // Whether this change may lose data
}
Change represents a single schema change
func CompareDatabases ¶
CompareDatabases compares two databases
type ChangeType ¶
type ChangeType string
ChangeType represents the type of schema change
const ( CreateTable ChangeType = "CREATE_TABLE" DropTable ChangeType = "DROP_TABLE" AddColumn ChangeType = "ADD_COLUMN" RecreateTable ChangeType = "RECREATE_TABLE" CreateIndex ChangeType = "CREATE_INDEX" DropIndex ChangeType = "DROP_INDEX" CreateView ChangeType = "CREATE_VIEW" DropView ChangeType = "DROP_VIEW" CreateTrigger ChangeType = "CREATE_TRIGGER" DropTrigger ChangeType = "DROP_TRIGGER" )
Click to show internal directories.
Click to hide internal directories.