Skip to content

Extension points

Everything in the pipeline is registered through DI. You can replace defaults or add to the enumerable extension points.

InterfacePurposeRegistered via
SQL DDL files (desired)The desired schema and any inline PRE/POST DEPLOYMENT scripts.AddDdlSchemas(...) (may be called more than once; sources aggregate)
ISchemaProvider (online current)Read the current live database schema.UseCurrentSchema<T>() (or via a provider package, e.g. UseCurrentSchemaPostgres(...))
ISchemaPolicyValidate the merged desired schema.AddSchemaPolicy<T>()
IDiffPolicyValidate the structured diff (e.g. the built-in destructive-action policy).AddDiffPolicy<T>()
ISqlGeneratorGenerate the SQL for a migration plan, keyed by Dialect. Add support for another database.AddSqlGenerator<T>(dialect) (or via a provider package); select with WithDialect(...)
ISchemaStateStoreOptional backend state store for tracking the last applied schema.UseStateStore<T>() / UseStateStore(instance) / UseFileStateStore(path)

These extension points are less commonly used, but still available for advanced scenarios.

InterfacePurposeRegistered via
IDiffRendererCustomize how the migration diff is rendered to text (e.g. JSON instead of Terraform-style).UseTerraformRenderer(...) / UseDiffRenderer<TRenderer>()
ISqlPlanRendererCustomize how the SQL preview is rendered to text (e.g. JSON for CI).UseSqlPlanRenderer<TRenderer>()
IOperationReporterCustomize run output. Register several and select one via NSchemaApplicationOptions.Reporter.AddReporter<T>(format) / AddReporter(instance) (last-wins per key)