platformsh / legacy-cli

This is the legacy version of Platform.sh's command-line interface. The new version is at: https://github.com/platformsh/cli
https://docs.platform.sh/administration/cli.html
MIT License
224 stars 121 forks source link

Allow to skip/structure tables on evironment:sqldump #513

Closed hanoii closed 7 years ago

hanoii commented 7 years ago

I would really love to have this, I think it's a very valuable thing to have, and I would like it to support wildcards, very much like how drush works.

I started working a bit on this (it's still WIP): https://github.com/platformsh/platformsh-cli/compare/development...hanoii:sqldump-skip

Which is also related to #512, although that's most of a middle solution.

But I see it getting complex:

Drush has a bit of logic that can be borrowed, which is a bit of what I attempted to do, although i only got as far as getting tables from mysql lunching and sql command from within sql-dump command.

I wonder what your thoughts are on this and if you would accept such a contribution.

I have been submitting a few PRs lately and I feel that when they are not trivial there's not much feedback/advise into how to improve them/getting them accepted, so not sure if it's worth spending more time on trying to work out something like this within platform-cli.

For now I worked out a platform ssh command like this

platform ssh '(TABLES="cache cache_form sessions watchdog"; MYSQLDUMP_IGNORE=""; for i in $TABLES ; do MYSQLDUMP_IGNORE="$MYSQLDUMP_IGNORE --ignore-table=main.$i" ; done ;  mysqldump -h database.internal -d main $TABLES; mysqldump -h database.internal main $MYSQLDUMP_IGNORE)'

Which seems to do what I need, but a robust client is always my preference.

pjcdawkins commented 7 years ago

Yes it could well be useful to have something that does SHOW TABLES and provides utilities on top of that, like Drush. Would PR #512 be surpassed by that?

(thanks for your PRs and sorry for slow progress on reviewing them, it's only for lack of time)

hanoii commented 7 years ago

Ok, I will see how far I can take it.. I still think that something like #512 is useful. Yes, a better solution for skipping tables would make the use of extra args on the dump command for something like this not necessary, but there could be other options that could be useful to have access to if needed.

512 seems easy, harmless and useful.

(that's fine, thanks for getting back!)