Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ApplyCmd = &cobra.Command{ Use: "apply", Short: "Apply migration plan to update a database schema", Long: "Apply a migration plan to update a database schema. Either provide a desired state file (--file) to generate and apply a plan, or provide a pre-generated plan file (--plan) to execute directly.", RunE: RunApply, SilenceUsage: true, PreRunE: util.PreRunEWithEnvVarsAndConnectionAndApp(&applyDB, &applyUser, &applyHost, &applyPort, &applyApplicationName), }
Functions ¶
func ApplyMigration ¶
func ApplyMigration(config *ApplyConfig, provider postgres.DesiredStateProvider) error
ApplyMigration applies a migration plan to update a database schema. The caller must provide either: - A pre-generated plan in config.Plan, OR - A desired state file in config.File with a non-nil provider instance
If config.File is provided, provider is used to generate the plan. The caller is responsible for managing the provider lifecycle (creation and cleanup).
Types ¶
type ApplyConfig ¶
type ApplyConfig struct {
Host string
Port int
DB string
User string
Password string
Schema string
File string // Desired state file (optional, used with embeddedPG)
Plan *plan.Plan // Pre-generated plan (optional, alternative to File)
AutoApprove bool
NoColor bool
Quiet bool // Suppress plan display and progress messages (useful for tests)
LockTimeout string
ApplicationName string
}
ApplyConfig holds configuration for apply execution
Click to show internal directories.
Click to hide internal directories.