Documentation
¶
Index ¶
- func CollectMigrationsList(fsys afero.Fs) []string
- func Generate(ctx context.Context, schema []string, config pgconn.Config, overwrite bool, ...) error
- func PrintDebugBundleMessage(debugDir string)
- func SaveDebugBundle(bundle DebugBundle, fsys afero.Fs) (string, error)
- func SyncToMigrations(ctx context.Context, schema []string, file string, noCache bool, fsys afero.Fs, ...) error
- func TryCacheMigrationsCatalog(ctx context.Context, config pgconn.Config, prefix string, version string, ...) error
- func WriteDeclarativeSchemas(output diff.DeclarativeOutput, fsys afero.Fs) error
- type DebugBundle
- type SyncResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectMigrationsList ¶
CollectMigrationsList returns a list of local migration filenames for inclusion in a debug bundle.
func Generate ¶
func Generate(ctx context.Context, schema []string, config pgconn.Config, overwrite bool, noCache bool, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error
Generate exports a live database schema into files under supabase/declarative.
The workflow uses pg-delta catalogs so output can be deterministic and filtered by schema, then optionally prompts before replacing existing files.
func PrintDebugBundleMessage ¶
func PrintDebugBundleMessage(debugDir string)
PrintDebugBundleMessage prints instructions for reporting an issue after saving a debug bundle.
func SaveDebugBundle ¶
func SaveDebugBundle(bundle DebugBundle, fsys afero.Fs) (string, error)
SaveDebugBundle writes diagnostic artifacts to .temp/pgdelta/debug/<ID>/ and returns the directory path.
func SyncToMigrations ¶
func SyncToMigrations(ctx context.Context, schema []string, file string, noCache bool, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error
SyncToMigrations diffs local declarative files against migration state and writes the delta as a new migration file.
func WriteDeclarativeSchemas ¶
func WriteDeclarativeSchemas(output diff.DeclarativeOutput, fsys afero.Fs) error
WriteDeclarativeSchemas materializes pg-delta declarative output on disk and updates schema_paths so downstream commands read from declarative files.
Types ¶
type DebugBundle ¶
type DebugBundle struct {
ID string // timestamp-based unique ID (e.g. "20240414-044403")
SourceRef string // path to source catalog
TargetRef string // path to target catalog
MigrationSQL string // generated migration (if available)
Error error // the error that occurred
Migrations []string // list of local migration files
}
DebugBundle collects diagnostic artifacts when a declarative operation fails.
type SyncResult ¶
type SyncResult struct {
DiffSQL string // The generated migration SQL
SourceRef string // Migrations catalog ref (for debug)
TargetRef string // Declarative catalog ref (for debug)
DropWarnings []string // Any DROP statements found
}
SyncResult holds the output of a declarative-to-migrations diff operation.
func DiffDeclarativeToMigrations ¶
func DiffDeclarativeToMigrations(ctx context.Context, schema []string, noCache bool, fsys afero.Fs, options ...func(*pgx.ConnConfig)) (*SyncResult, error)
DiffDeclarativeToMigrations computes the diff between local migrations state and declarative schema files, returning the result without writing anything.