Documentation
¶
Index ¶
- Constants
- func ConnectShadowDatabase(ctx context.Context, timeout time.Duration, options ...func(*pgx.ConnConfig)) (conn *pgx.Conn, err error)
- func CreateShadowDatabase(ctx context.Context, port uint16) (string, error)
- func DiffDatabase(ctx context.Context, schema []string, config pgconn.Config, w io.Writer, ...) (string, error)
- func DiffPgDelta(ctx context.Context, source, target pgconn.Config, schema []string, ...) (string, error)
- func DiffPgDeltaRef(ctx context.Context, sourceRef, targetRef string, schema []string, ...) (string, error)
- func DiffPgSchema(ctx context.Context, source, target pgconn.Config, schema []string, ...) (string, error)
- func DiffSchemaMigra(ctx context.Context, source, target pgconn.Config, schema []string, ...) (string, error)
- func DiffSchemaMigraBash(ctx context.Context, source, target pgconn.Config, schema []string, ...) (string, error)
- func DiffSchemaPgAdmin(ctx context.Context, source, target string, schema []string, p utils.Program) (string, error)
- func ExportCatalogPgDelta(ctx context.Context, targetRef, role string, options ...func(*pgx.ConnConfig)) (string, error)
- func MigrateShadowDatabase(ctx context.Context, container string, fsys afero.Fs, ...) error
- func Run(ctx context.Context, schema []string, file string, config pgconn.Config, ...) (err error)
- func RunExplicit(ctx context.Context, fromRef, toRef string, schema []string, outputPath string, ...) error
- func RunPgAdmin(ctx context.Context, schema []string, file string, config pgconn.Config, ...) error
- func SaveDiff(out, file string, fsys afero.Fs) error
- type DeclarativeFile
- type DeclarativeOutput
- type DiffFunc
Constants ¶
const CREATE_TEMPLATE = "CREATE DATABASE contrib_regression TEMPLATE postgres"
Required to bypass pg_cron check: https://github.com/citusdata/pg_cron/blob/main/pg_cron.sql#L3
Variables ¶
This section is empty.
Functions ¶
func ConnectShadowDatabase ¶
func CreateShadowDatabase ¶
func DiffDatabase ¶
func DiffPgDelta ¶
func DiffPgDelta(ctx context.Context, source, target pgconn.Config, schema []string, options ...func(*pgx.ConnConfig)) (string, error)
DiffPgDelta diffs source and target Postgres configs via pg-delta.
This wrapper preserves the old config-based interface while delegating to DiffPgDeltaRef, which also supports catalog-file references. Format options are read from config so DiffFunc callers do not need to change.
func DiffPgDeltaRef ¶
func DiffPgDeltaRef(ctx context.Context, sourceRef, targetRef string, schema []string, formatOptions string, options ...func(*pgx.ConnConfig)) (string, error)
DiffPgDeltaRef supports pg-delta diffing across both live database URLs and on-disk catalog references used by declarative sync commands. formatOptions is passed through as FORMAT_OPTIONS to the pg-delta script when non-empty.
func DiffPgSchema ¶
func DiffSchemaMigra ¶
func DiffSchemaMigraBash ¶
func DiffSchemaMigraBash(ctx context.Context, source, target pgconn.Config, schema []string, options ...func(*pgx.ConnConfig)) (string, error)
Diffs local database schema against shadow, dumps output to stdout.
func DiffSchemaPgAdmin ¶
func ExportCatalogPgDelta ¶
func ExportCatalogPgDelta(ctx context.Context, targetRef, role string, options ...func(*pgx.ConnConfig)) (string, error)
ExportCatalogPgDelta snapshots a database/catalog into serialized pg-delta catalog JSON so later operations can diff without reconnecting.
func MigrateShadowDatabase ¶
func RunExplicit ¶
func RunPgAdmin ¶
Types ¶
type DeclarativeFile ¶
type DeclarativeFile struct {
Path string `json:"path"`
Order int `json:"order"`
Statements int `json:"statements"`
SQL string `json:"sql"`
}
DeclarativeFile mirrors the per-file payload returned by pg-delta declarative export so the CLI can materialize structured SQL files on disk.
type DeclarativeOutput ¶
type DeclarativeOutput struct {
Version int `json:"version"`
Mode string `json:"mode"`
Files []DeclarativeFile `json:"files"`
}
DeclarativeOutput is the top-level declarative export envelope emitted by the pg-delta script and consumed by db/declarative workflows.
func DeclarativeExportPgDelta ¶
func DeclarativeExportPgDelta(ctx context.Context, source, target pgconn.Config, schema []string, formatOptions string, options ...func(*pgx.ConnConfig)) (DeclarativeOutput, error)
DeclarativeExportPgDelta exports target schema as declarative file payloads while keeping a config-based API for existing call sites.
func DeclarativeExportPgDeltaRef ¶
func DeclarativeExportPgDeltaRef(ctx context.Context, sourceRef, targetRef string, schema []string, formatOptions string, options ...func(*pgx.ConnConfig)) (DeclarativeOutput, error)
DeclarativeExportPgDeltaRef exports declarative file payloads using either live URLs or catalog references as source/target inputs.