ttcDbSnapshotPlugin - 1.0.0

Save, load and Sync mysql databases

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
ttcDbSnapshotPlugin 1.0.0stable for sf 1.4sf 1.3 and Doctrine MIT
Plugin image
0
user
Sign-in
to change
your status

The ttcDbSnapshotPlugin lets you take snapshot of a database, load a saved snapshot, or take one on your production server and load it on your developement server.

ttcDbSnapshotPlugin

Usage Scenarios

  1. You are testing a feature but it's tedious to revert and test again because of many data changes - save data then reload.
  2. Client has a problem with some of it's data - sync remote prod to local dev and test with real data

Requirements/Limitations

To be fast and take usable snapshot, the plugin uses mysqldump to save, and mysql to load which are both available on linux/unix system which means windows users won't be able to use this plugin as is.

For now it also parses the databases.yml file to get connection credentials thru Doctrine_Manager which also means Propel users can't use it unless you provide your own getConnectionCredentials() like in baseTtcDbSnapshotTask.class.php

Basic Usage

The tasks to do all these actions requires the mysqldump and mysql executable to be available which probably means trouble for windows users but hopefully your production server uses linux and you should be able to get benefits like I do from this plugin.

  • To take a snapshot: $ symfony ttc:take-snapshot

  • To load one: $ symfony ttc:load-snapshot

Syncing

To use the syncing feature with ease, you are not required to but you should create a public/private ssh key pair and upload your public key to your server, then create a config file in your .ssh home folder that would look like this:

Host myprodserver

Hostname myprodserver.com

User prodLinuxUsername

IdentityFile /.ssh/private_key

Port 12345

Then to sync your production data to your dev data, you would use: $ symfony ttc:load-snapshot-from --env=dev myprodserver '/sf' prod

  1. Will use the config above to connect thru ssh.
  2. From the '~/sf' folder on your production, it will use the prod connection and ttc:take-snapshot there.
  3. Then it will transfer the saved snapshot thru ssh again to data/remote_ttc_db_snapshot_prod.sql
  4. And finally it will run ttc:load-snapshot --env=dev full_path_to/remote_ttc_db_snapshot_prod.sql

Developers

Name Status Email
gravatar Anthony Servedio lead moc.ciffartonhcet <<ta>> oidevres.a

License

Show source

Copyright (c) 2011 Anthony Servedio

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.