Repository navigation
feat(engines): add PostgreSQL driver - #4
Merged
Merged
Conversation
pg_dump/pg_restore/psql inside the local postgres container: whole-db clones stage a transient -Fd archive for pg_restore -j (which cannot read stdin), -only subsets stream a filtered plain-format dump through psql. Includes preflight contract, compose service, docs and unit+integration tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
internal/driver/postgrespackage implementingdriver.Driver—postgres:dbdatabases clone between any two endpoints (remote→local, local→remote, remote→remote) with the same streaming, retried, pooled pipeline as mongo/mysql.pg_dump -Fdwrites a transient archive dir inside the local container →pg_restore -j --clean --if-exists --no-owner --no-privilegesrestores it (pg_restore -jcannot read from stdin, so the stage lives inside the container and is removed per attempt). Dump-side-jis skipped to avoid snapshot privileges on managed hosts.-only postgres:db.schema.table: plain-formatpg_dump -Fp -tin three phases — pre-data+data, selected tables' trigger functions viapg_get_functiondef, then post-data through anawkfilter that drops FKs referencing unselected objects (reported as warnings).postgresimage,DBCLONE_POSTGRES_CONTAINER,POSTGRES_PASSWORD;compose.yaml,README.md,profiles.example.jsonupdated.Closes #3
Test plan
gofmt -l .,go vet ./...,go build ./...— cleango test ./...— all packages green-targs, awk FK filter,Permanent, stage markers)postgres:17-alpinecontainers over a private network: preflight, whole-db clone (schemas, view, matview data, function, trigger, sequence setval, re-run clean),-onlysubset (dangling FK skipped+warned),-freshunder an open connection, remote→remote, auth fast-failinternal/driver/postgres