Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

PLAT-340 Adding db:local:dump and db:local:restore phing commands #362

Merged
merged 2 commits into from
Jul 7, 2016

Conversation

pvhee
Copy link
Contributor

@pvhee pvhee commented Jul 7, 2016

Fixes https://jira.comicrelief.com/browse/PLAT-340

phing db:local:dump will dump the database to /tmp/cr.sql

phing db:local:restore will restore that database

Very useful to debug, reduce build times, check update process rather than clean builds, etc!

<target name="db:local:dump"
description="Dump local database">
<exec checkreturn="true" logoutput="true" passthru="true"
command="${drush.bin} sql-dump --skip-tables-key=common --ordered-dump --result-file='/tmp/${app.profile.name}.sql'"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pvhee I'm just curious: where is the common array defined? Is that essentially cache tables?

Also, it doesn't really matter that you're exporting to .sql and not using `--gzip' does it?

Thanks.

Copy link
Contributor Author

@pvhee pvhee Jul 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peter-brady

As per the docs this is defined drushrc.php for each user. Most ppl won't have this defined, so we're not actually skipping any table!

Re. zipping, since this is to dump the db. locally and restore locally, I don't think there's a point in zipping this as it'll take a little longer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pvhee

Cool. Makes sense.

Thanks.

@bimsonz
Copy link
Contributor

bimsonz commented Jul 7, 2016

@pvhee travis failing due to error you and Gus are discussing...

@bimsonz
Copy link
Contributor

bimsonz commented Jul 7, 2016

Other than that looks good!

<target name="db:restore" description="Restore DB from specified back up"> <exec checkreturn="true" logoutput="true" passthru="true" command="${drush.bin} sql-drop -y --verbose"/> <exec checkreturn="true" logoutput="true" passthru="true" command="${drush.bin} sql-cli &lt; /tmp/${file}.sql --verbose"/> <exec checkreturn="true" logoutput="true" passthru="true" command="${drush.bin} cr"/> </target>

Could be used but i guess its a different use case and your command makes it more automatic! So lets get it in!

@bimsonz bimsonz merged commit de3c590 into develop Jul 7, 2016
@bimsonz bimsonz deleted the feature/PLAT-340_phing_db_dump branch July 7, 2016 09:39
@pvhee pvhee mentioned this pull request Jan 5, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants