Skip to content

Delete tables on reimport #53

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

elaberge
Copy link

Calling "ImportAllSource" create duplicate tables (ie.: MyTable1 if MyTable already exist), and fill the original table with data. This issue was introduced on commit 2bf2b3c. This PR deletes the original table as per the old behavior.

@elaberge
Copy link
Author

I had intended the third commit to be part of another pull request, but it ended up in this one...

Commit 2d56c87 adds a flag to save extra data when exporting table definitions. I had an issue where field formats such as dropdown lists or checkboxes would be lost on reimport, and this fixes that issue.

@timabell
Copy link
Member

Dropping tables is fairly dangerous, I wonder if we should provide some kind of safety mechanism to prevent accidents

@elaberge
Copy link
Author

I suggest adding a config to prefix the existing table, or delete it if empty. A prefix would be better than a suffix to keep the renamed tables together for easy deletion.

@timabell
Copy link
Member

I'd probably er on the side of crashing out hard if there's a clash, but it's probably worth canvassing the opinion of regular contributors and ideally users if we can work out how to!

@jwbrookes jwbrookes self-requested a review April 23, 2017 10:08
@daialogue
Copy link

Hi,
I am starting to use your package - very nice idea, by the way. It looks to me that the behavior here should be to TRY to copy the data from table EXAMPLE to EXAMPLE1 (using a select into or something similar), if it fails it leaves both copies with a warning message; if it is succeeded, delete EXAMPLE, rename EXAMPLE1 to EXAMPLE. I can implement this if everyone agrees. As the code is now, we are getting a lot of tables1 without sense (sorry if I miss something).
A Database backup before any importAllSource, should be a good practice... it is data after all, not codebase.

@lastlink
Copy link
Collaborator

lastlink commented Apr 7, 2018

this does seem like a staging table scenario. You createa staging table if it succeeds delete the others and then do a rename.

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

Successfully merging this pull request may close these issues.

4 participants