Repository navigation
db: clone idle databases fast via CREATE DATABASE TEMPLATE - #72
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🔍 Devin Review: 1 flag
Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
`osh db copy` and the missing-database copy option now clone an idle source via `CREATE DATABASE ... TEMPLATE` — near-instant even for large databases — instead of always piping pg_dump into pg_restore. When the source has open connections a prompt offers to close them for the fast clone, keep them for the slower dump/restore copy, or abort; non-interactive runs keep the connections. The dump/restore path now streams pg_dump stdout through a host temp file into pg_restore's stdin so both halves show progress, reusing the restore progress bar (moved into termui as stdin_progress, joined by a file_progress spinner for the unknown-total dump side) and reporting elapsed time when done. The connection prompt runs before the target is dropped, so aborting leaves it untouched; copying a database onto itself is rejected. Assisted-by: Devin:SWE-2 High
dreispt
force-pushed
the
feature/db-copy-template
branch
from
October 27, 2026 18:51
0395b13 to
cfdb226
Compare
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
osh db copyand the missing-database copy option ([c]inosh odoo) now clone an idle source viaCREATE DATABASE ... TEMPLATE— near-instant even for large databases — instead of always pipingpg_dumpintopg_restorepg_dumpstdout through a host temp file intopg_restorestdin, so both halves show progress: a spinner + growing size for the dump, then the restore progress bar — and reports elapsed time when done_stdin_progressmoved fromosh_backup.restore_opsintotermuiasstdin_progress, plus a newfile_progressfor unknown-total transfers andhuman_size/human_durationTest plan
pytest tests/— 444 passed, including new cases: open-connection close/keep/abort, non-TTY fallback, same-name guardosh db copy src dstwith an idle source → TEMPLATE clonepsqlconnection → prompt → slow path with progress barsAssisted-by: Devin:SWE-2 High