n98-magerun icon indicating copy to clipboard operation
n98-magerun copied to clipboard

Option for stripped dumps to not drop tables

Open jonpday opened this issue 11 years ago • 7 comments

Tables in the stripped groups are automatically added to the first mysqldump line so that they are exported as structure-only. There are times when the dump is being created to import into an existing database where those tables (e.g. sales, customers) should not be deleted by dropping tables, so the first mysqldump is not required. An option like "--no-structure-only" would be useful.

jonpday avatar May 12 '13 05:05 jonpday

+1!

Also related: In this case it would be nice to be able to configure a whitelist of tables (instead of a blacklist/stripped). This way you could n98-magerun e.g. to export cms content from one environment and import it into another one. Reusing the same mechanism for configuring for table groups would be great.

fbrnc avatar May 12 '13 05:05 fbrnc

@fbrnc nice.

In the short term, this will work from bash:

n98-magerun.phar db:dump --only-command --strip="@development" --stdout | tail -n 1 | sh -s

jonpday avatar May 12 '13 07:05 jonpday

The idea of db:dump (also with --strip) is, that we get a full Magento database structure after importing. With such an option, we can only import onto an existing database. I think this is a quite special usecase. The workaround might be enough? What do you think?

amenk avatar Jul 27 '13 16:07 amenk

Thanks for your response Alex. I'm happy to continue using the workaround if that's what is best for the project.

jonpday avatar Jul 28 '13 10:07 jonpday

In the internal tools I built to pull a remote database over SSH, I'm pulling a structure only dump followed by a data dump with the appropriate exclusions. Both of them go through filters to remove DEFINERS on triggers, but it solves the problem of having to pull over an existing database, something which can cause trouble if you have different versions of install scripts. Maybe a similar thing could work here?

David Alger, CTO, Classy Llama Sent from my iPhone 4S

On Jul 28, 2013, at 5:49 AM, Jonathan Day [email protected] wrote:

Thanks for your response Alex. I'm happy to continue using the workaround if that's what is best for the project.

— Reply to this email directly or view it on GitHubhttps://github.com/netz98/n98-magerun/issues/138#issuecomment-21681663 .

davidalger avatar Jul 28 '13 14:07 davidalger

Never mind me... I apparently didn't read the first part of this thread, and only the last bit of it in my email. :)

David Alger, CTO, Classy Llama Sent from my iPhone 4S

On Jul 28, 2013, at 5:49 AM, Jonathan Day [email protected] wrote:

Thanks for your response Alex. I'm happy to continue using the workaround if that's what is best for the project.

— Reply to this email directly or view it on GitHubhttps://github.com/netz98/n98-magerun/issues/138#issuecomment-21681663 .

davidalger avatar Jul 29 '13 00:07 davidalger

This ticket and the workaround saved me. Please add a --non-destructive option.

yoosefi avatar Jul 06 '17 22:07 yoosefi