Documentation
¶
Index ¶
- Variables
- func CreateDesiredStateProvider(config *PlanConfig) (postgres.DesiredStateProvider, error)
- func CreateEmbeddedPostgresForPlan(config *PlanConfig, pgVersion postgres.PostgresVersion) (*postgres.EmbeddedPostgres, error)
- func GeneratePlan(config *PlanConfig, provider postgres.DesiredStateProvider) (*plan.Plan, error)
- func ResetFlags()
- type PlanConfig
Constants ¶
This section is empty.
Variables ¶
var PlanCmd = &cobra.Command{ Use: "plan", Short: "Generate migration plan for a specific schema", Long: "Generate a migration plan to apply a desired schema state to a target database schema. Compares the desired state (from --file) with the current state of a specific schema (specified by --schema, defaults to 'public').", RunE: runPlan, SilenceUsage: true, PreRunE: util.PreRunEWithEnvVarsAndConnection(&planDB, &planUser, &planHost, &planPort), }
Functions ¶
func CreateDesiredStateProvider ¶
func CreateDesiredStateProvider(config *PlanConfig) (postgres.DesiredStateProvider, error)
CreateDesiredStateProvider creates either an embedded PostgreSQL instance or connects to an external database for validating the desired state schema. The caller is responsible for calling Stop() on the returned provider.
func CreateEmbeddedPostgresForPlan ¶
func CreateEmbeddedPostgresForPlan(config *PlanConfig, pgVersion postgres.PostgresVersion) (*postgres.EmbeddedPostgres, error)
CreateEmbeddedPostgresForPlan creates a temporary embedded PostgreSQL instance for validating the desired state schema. The instance should be stopped by the caller.
func GeneratePlan ¶
func GeneratePlan(config *PlanConfig, provider postgres.DesiredStateProvider) (*plan.Plan, error)
GeneratePlan generates a migration plan from configuration. The caller must provide a non-nil provider instance for validating the desired state schema. The caller is responsible for managing the provider lifecycle (creation and cleanup).
func ResetFlags ¶
func ResetFlags()
ResetFlags resets all global flag variables to their default values for testing
Types ¶
type PlanConfig ¶
type PlanConfig struct {
Host string
Port int
DB string
User string
Password string
Schema string
File string
ApplicationName string
// Plan database configuration (optional - for external database)
PlanDBHost string
PlanDBPort int
PlanDBDatabase string
PlanDBUser string
PlanDBPassword string
}
PlanConfig holds configuration for plan generation