Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] schema-only should confirm before existing table is dropped! #175

Open
sunapi386 opened this issue Jan 9, 2023 · 1 comment
Open

Comments

@sunapi386
Copy link

The flag --schema-only is misleading, if it drops the table there needs to be user confirmation!

Although the documentation states so, it would be easy to miss. Please enforce and add confirmation (y/n) in code before proceeding. Optionally, add a flag --drop-if-conflict and drop table if the schema sync fails.

Currently the docs say

Sync schema before the data (this wipes out existing data)

pgsync --schema-first
Specify tables

pgsync table1,table2 --schema-first
Or just the schema

pgsync --schema-only

ankane added a commit that referenced this issue Feb 5, 2023
@ankane
Copy link
Owner

ankane commented Feb 5, 2023

Hey @sunapi386, thanks for the suggestion. Most pgsync operations delete/truncate existing data, so I'm not sure this is much different from other operations in terms of safety (although there's probably a better name for it).

pgsync checks the destination database is local (or --to-safe is passed) as the primary safety check.

I've adjusted the docs to try to make it clear --schema-only wipes data as well, and will leave this open to think about other changes for when there are existing tables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants