feat(backup): add File > Backup… for PostgreSQL via pg_dump#1210
feat(backup): add File > Backup… for PostgreSQL via pg_dump#1210samirmhsnv wants to merge 2 commits into
Conversation
Picks a database from the current connection, prompts for a destination, and runs pg_dump with the custom archive format (-Fc), surfacing live byte progress and a cancel that cleans up the partial file. Reuses the active SSH tunnel via session.effectiveConnection so tunneled connections work without spinning up a second tunnel. pg_dump path is auto-detected from PATH and common Homebrew locations, with an override under Settings > Terminal > CLI Paths.
|
Thank you for your contribution! Before we can merge this PR, you need to sign our Contributor License Agreement. To sign, please comment below with:
I have read the CLA Document and I hereby sign the CLA. 1 out of 2 committers have signed the CLA. |
|
I have read the CLA Document and I hereby sign the CLA. |
Picks a .dump file via NSOpenPanel, then a target database on the current PostgreSQL or Redshift connection, then runs pg_restore --no-owner --no-acl with progress and cancel. Reuses the active SSH tunnel via session.effectiveConnection. pg_restore path is auto-detected with a custom override under Settings > Terminal > CLI Paths. The backup progress and result sheets gain a Kind enum so both flows share them. DatabaseSwitcherSheet gains a .restore mode alongside .backup; both hide the schemas tab and create/drop affordances and hand the selection to the parent flow without auto-dismissing.
|
Superseded by #1211, which covers both Backup and Restore with a combined description and test plan. |
Summary
File > Backup…menu item for PostgreSQL and Redshift connections. Pick a database, choose a destination, runspg_dump -Fcwith live byte progress and cancel.session.effectiveConnection, so tunneled connections work without opening a second port forward.pg_dumpis auto-detected fromPATHand common Homebrew locations. Override under Settings > Terminal > CLI Paths > pg_dump.Notes for reviewers
DatabaseSwitcherSheetgains aModeenum (.switchdefault,.backup). Existing call sites stay on the default and are unchanged. In backup mode the schemas tab and create/drop affordances are hidden, the primary button reads "Back Up…", and the callback does not auto-dismiss so the host sheet can transition to the save panel.PostgresBackupServicepolls file size every 250ms for progress (pg_dump has no progress hook). Cancel sends SIGTERM and removes the partial file. Stderr is captured (capped at 64KB) and shown on failure.PGSSLMODEvalues (require,verify-ca,verify-full, etc.) instead of being passed through verbatim.--no-passwordis passed topg_dumpso it fails fast with an auth error instead of hanging on a TTY prompt whenPGPASSWORDis missing.xcodebuildfrom CLI fails locally on a SwiftLint plugin sandbox issue inCodeEditTextView/CodeEditSourceEditor(unrelated to this change). SwiftLint--strictis clean on every changed file. Verify the build from Xcode.Test plan
.dumpfile is a valid custom-format archive (pg_restore -l file.dump).lsof).