Documentation
¶
Overview ¶
Package workflow provides shared schema processing pipelines used by multiple CLI commands (generate, diff, dump-sql, schema2diagram, find-includes).
Index ¶
- func ExecuteDumpSQL(cmd *cobra.Command, databaseType string, pending bool, verbose bool, ...) error
- func ExecuteFindIncludes(cmd *cobra.Command, configFile, schemaPath string, ...) error
- func MergeAndValidateSchemas(components *SchemaComponents, allSchemas []*yamlpkg.Schema, ...) (*yamlpkg.Schema, error)
- func ScanAndParseSchemas(components *SchemaComponents, verbose bool) ([]*yamlpkg.Schema, error)
- type DAGQuerier
- type DiscoveredSchema
- type FindIncludesCallbacks
- type LocalSchemaFile
- type SchemaComponents
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteDumpSQL ¶
func ExecuteDumpSQL(cmd *cobra.Command, databaseType string, pending bool, verbose bool, configFile string, dagQuerier *DAGQuerier) error
ExecuteDumpSQL handles the complete dump SQL process. When pending is true, it shows only the SQL for pending schema changes (what the next migration would do). When false, it dumps the full schema.
func ExecuteFindIncludes ¶
func ExecuteFindIncludes(cmd *cobra.Command, configFile, schemaPath string, interactive, includeWorkspace bool, callbacks *FindIncludesCallbacks) error
ExecuteFindIncludes handles the complete find includes process
func MergeAndValidateSchemas ¶
func MergeAndValidateSchemas(components *SchemaComponents, allSchemas []*yamlpkg.Schema, dbType yamlpkg.DatabaseType, verbose bool) (*yamlpkg.Schema, error)
MergeAndValidateSchemas merges schemas and validates the result
func ScanAndParseSchemas ¶
func ScanAndParseSchemas(components *SchemaComponents, verbose bool) ([]*yamlpkg.Schema, error)
ScanAndParseSchemas scans for Starlark schema files and loads them
Types ¶
type DAGQuerier ¶
type DAGQuerier struct {
// QueryDAG loads migrations from the given directory and returns the
// previous schema as a *yamlpkg.Schema (or nil if no migrations exist).
QueryPreviousSchema func(migrationsDir string, dbType string, verbose bool) (*yamlpkg.Schema, error)
}
DAGQuerier provides the callback functions needed by ExecuteDumpSQL to query the migration DAG without depending on the migrate or interp packages.
type DiscoveredSchema ¶
type DiscoveredSchema struct {
ModulePath string
RelativePath string
FullPath string
IsWorkspace bool
Schema *yamlpkg.Schema
TableCount int
DatabaseName string
DatabaseType string
}
DiscoveredSchema represents a schema found during discovery
type FindIncludesCallbacks ¶
type FindIncludesCallbacks struct {
FindLocalSchemaFiles func() ([]LocalSchemaFile, error)
SelectLocalSchemaFile func([]LocalSchemaFile) (string, error)
DiscoverSchemas func() ([]DiscoveredSchema, error)
SelectSchemasInteractively func([]DiscoveredSchema) ([]DiscoveredSchema, error)
LoadExistingSchema func(string) (*yamlpkg.Schema, error)
FilterNewSchemas func([]DiscoveredSchema, *yamlpkg.Schema) []DiscoveredSchema
UpdateSchemaWithIncludes func(string, *yamlpkg.Schema, []DiscoveredSchema) error
}
FindIncludesCallbacks holds the callback functions needed by ExecuteFindIncludes to interact with the file system and user without depending on cmd-internal types.
type LocalSchemaFile ¶
LocalSchemaFile represents a local schema file found in the current directory
type SchemaComponents ¶ added in v1.13.0
type SchemaComponents struct {
StateManager *yamlpkg.StateManager
Scanner *scanner.Scanner
Parser *yamlpkg.Parser
Merger *yamlpkg.Merger
DiffEngine *yamlpkg.DiffEngine
}
SchemaComponents holds the initialized schema processing components
func InitializeSchemaComponents ¶ added in v1.13.0
func InitializeSchemaComponents(dbType yamlpkg.DatabaseType, verbose bool) *SchemaComponents
InitializeSchemaComponents creates and initializes all schema processing components