Documentation
¶
Index ¶
- Constants
- type Auth0Config
- type ClerkConfig
- type Config
- type ConfigValidationError
- type ConflictResolutionConfig
- type FunctionRulesConfig
- type GenericJSONError
- type IndexRulesConfig
- type JSONSyntaxError
- type JSONTypeError
- type ModernFeaturesConfig
- type NextAuthConfig
- type OutputConfig
- type PerformanceConfig
- type PlanetScaleConfig
- type PluginSettings
- type PostgreSQLFeaturesConfig
- type RulesConfig
- type StaticValidatorConfig
- type SupabaseConfig
- type TableRulesConfig
- type ThirdPartyConfig
- type ValidationConfig
- type ValidationErrors
- type VectorConfig
Constants ¶
const ValidationDSNEnv = "CAPYSQUASH_VALIDATION_DSN"
ValidationDSNEnv names the environment variable holding the validation database connection string (the same one validate-external reads with --dsn-env CAPYSQUASH_VALIDATION_DSN).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth0Config ¶
type ClerkConfig ¶
type Config ¶
type Config struct {
SafetyLevel string `json:"safety_level"`
ProdDBDSN string `json:"prod_db_dsn"`
// ValidationDSN is an empty, disposable database the paranoid level
// applies the squashed baseline to, so its catalog can be compared with
// production's. Defaults to CAPYSQUASH_VALIDATION_DSN.
ValidationDSN string `json:"validation_dsn,omitempty"`
Output OutputConfig `json:"output"`
Rules RulesConfig `json:"rules"`
ExcludePatterns []string `json:"exclude_patterns"`
IncludeSchemas []string `json:"include_schemas"`
Performance PerformanceConfig `json:"performance"`
ModernFeatures ModernFeaturesConfig `json:"modern_features"`
ConflictResolution ConflictResolutionConfig `json:"conflict_resolution"`
PostgreSQLFeatures PostgreSQLFeaturesConfig `json:"postgresql_features"`
ThirdPartyIntegrations ThirdPartyConfig `json:"third_party_integrations"`
Plugins PluginSettings `json:"plugins"` // Plugin system configuration
Validation ValidationConfig `json:"validation"` // Docker validation configuration
StaticValidation StaticValidatorConfig `json:"static_validation"` // Static analysis rules configuration
}
func DefaultConfig ¶
func DefaultConfig() *Config
func LoadConfig ¶
func (*Config) SaveToFile ¶
type ConfigValidationError ¶
ConfigValidationError represents config validation errors with helpful messages
func (*ConfigValidationError) Error ¶
func (e *ConfigValidationError) Error() string
type FunctionRulesConfig ¶
type GenericJSONError ¶
GenericJSONError represents other JSON parsing errors
func (*GenericJSONError) Error ¶
func (e *GenericJSONError) Error() string
type IndexRulesConfig ¶
type JSONSyntaxError ¶
JSONSyntaxError represents a JSON syntax error with helpful context
func (*JSONSyntaxError) Error ¶
func (e *JSONSyntaxError) Error() string
type JSONTypeError ¶
type JSONTypeError struct {
Path string
Line int
Column int
Context string
Field string
Expected string
Got string
}
JSONTypeError represents a JSON type mismatch error
func (*JSONTypeError) Error ¶
func (e *JSONTypeError) Error() string
type ModernFeaturesConfig ¶
type ModernFeaturesConfig struct {
EnableVectorSupport bool `json:"enable_vector_support"`
EnableGeneratedColumns bool `json:"enable_generated_columns"`
EnableEventSourcing bool `json:"enable_event_sourcing"`
EnableMergeStatements bool `json:"enable_merge_statements"`
EnableMultirangeTypes bool `json:"enable_multirange_types"`
EnableAdvancedRLS bool `json:"enable_advanced_rls"`
}
type NextAuthConfig ¶
type OutputConfig ¶
type PerformanceConfig ¶
type PlanetScaleConfig ¶
type PluginSettings ¶
type PluginSettings struct {
AutoDetect bool `json:"auto_detect"` // Automatically detect and enable plugins (default: true)
EnabledPlugins []string `json:"enabled_plugins"` // Explicitly enabled plugins (empty = auto-detect all)
DisabledPlugins []string `json:"disabled_plugins"` // Explicitly disabled plugins
Verbose bool `json:"verbose"` // Log plugin activity (default: false)
}
PluginSettings configures the plugin system behavior
type PostgreSQLFeaturesConfig ¶
type PostgreSQLFeaturesConfig struct {
TargetVersion string `json:"target_version"`
EnabledExtensions []string `json:"enabled_extensions"`
OptimizeForPerformance bool `json:"optimize_for_performance"`
UseModernSyntax bool `json:"use_modern_syntax"`
ValidateCompatibility bool `json:"validate_compatibility"`
UseASTAnalyzer bool `json:"use_ast_analyzer"` // Use AST-based analyzer instead of regex (default: true)
}
type RulesConfig ¶
type RulesConfig struct {
TableOperations TableRulesConfig `json:"table_operations"`
IndexOperations IndexRulesConfig `json:"index_operations"`
FunctionOperations FunctionRulesConfig `json:"function_operations"`
// Overrides force-enables (true) or force-disables (false) specific named
// consolidation rules relative to the safety-level baseline. Keys are rule
// names as registered in the consolidation rule registry (e.g.
// "create_alter_consolidation"). Unknown rule names are rejected when the
// engine is constructed. A nil/empty map applies the baseline unchanged.
Overrides map[string]bool `json:"overrides,omitempty"`
}
type StaticValidatorConfig ¶
type StaticValidatorConfig struct {
// EnabledRules is a list of rule codes to enable.
// If empty or nil, all registered rules are enabled.
EnabledRules []string `json:"enabled_rules" yaml:"enabled_rules" toml:"enabled_rules"`
// RuleOptions allows passing custom configuration to specific rules.
// Key is the rule code.
RuleOptions map[string]map[string]any `json:"rule_options" yaml:"rule_options" toml:"rule_options"`
// TreatWarningsAsErrors causes all violations to be reported as errors
TreatWarningsAsErrors bool `json:"treat_warnings_as_errors" yaml:"treat_warnings_as_errors" toml:"treat_warnings_as_errors"`
// Strict makes a squash abort when pre-flight validation of the input
// migrations reports any violation or cannot run (squash --strict).
// Without it, pre-flight findings are reported as warnings.
Strict bool `json:"strict" yaml:"strict" toml:"strict"`
}
StaticValidatorConfig configures the static validator
func DefaultStaticValidatorConfig ¶
func DefaultStaticValidatorConfig() *StaticValidatorConfig
DefaultStaticValidatorConfig returns a default configuration
type SupabaseConfig ¶
type TableRulesConfig ¶
type ThirdPartyConfig ¶
type ThirdPartyConfig struct {
Auth0Integration Auth0Config `json:"auth0_integration"`
NextAuthIntegration NextAuthConfig `json:"nextauth_integration"`
SupabaseIntegration SupabaseConfig `json:"supabase_integration"`
ClerkIntegration ClerkConfig `json:"clerk_integration"`
VectorIntegration VectorConfig `json:"vector_integration"`
PlanetScaleIntegration PlanetScaleConfig `json:"planetscale_integration"`
}
type ValidationConfig ¶
type ValidationConfig struct {
Mode string `json:"mode"` // Validation approach: TWO_CONTAINERS, TWO_DATABASES, or SCHEMA_DIFF
DockerImage string `json:"docker_image"` // PostgreSQL Docker image (default: postgres:17)
TimeoutSeconds int `json:"timeout_seconds"` // Validation timeout in seconds (default: 120)
ContainerReadyTimeout int `json:"container_ready_timeout"` // Container startup timeout in seconds (default: 150, recommended for complex migrations with many extensions)
EnableExtensionDetection bool `json:"enable_extension_detection"` // Auto-detect and install extensions (default: true)
AutoInstallExtensions bool `json:"auto_install_extensions"` // Automatically install detected extensions (default: true)
EnableSQLFixes bool `json:"enable_sql_fixes"` // Apply automatic SQL fixes during validation (default: false)
EnablePreprocessing bool `json:"enable_preprocessing"` // Preprocess SQL to fix common issues (e.g., deduplicate publication statements) (default: true)
Verbose bool `json:"verbose"` // Show detailed validation output (default: true)
}
ValidationConfig configures Docker-based validation behavior
type ValidationErrors ¶
type ValidationErrors struct {
Errors []string
}
ValidationErrors contains multiple validation errors
func (*ValidationErrors) Error ¶
func (e *ValidationErrors) Error() string