README
dumpimp
Rake tasks to dump and import various database batch files. (currently only MySQL, but feel free to add additional)
db:dump
Description: Dump database file and gzip for RAILS_ENV. Initial path of dump is to "db/". Set alternate path with INITIAL_PATH=path/to/dump/. To skip gzip use GZIP=no.
Options: INITIAL_PATH=/my/db/dump/path/ (defaults to db/) GZIP=yes|no (defaults to yes) RAILS_ENV=production|development|test (default is development)
Examples: rake db:dump - dumps development database to file in db/ folder - then gzips the file so you're left with "env_database_name_dump.sql.gz"
rake db:dump INITIAL_PATH=.
- same as above except dumps into root of your application instead of db/
rake db:dump GZIP=no RAILS_ENV=production
- dumps production database to sql file in db/ folder
- does not gzip the file
db:import (or db:imp)
Description: Import database dump file into the specified RAILS_ENV. Select file with FILE=path/to/file. If the file is gzipped, it will be unzipped, imported and then gzipped back again.
Requirements: FILE=path/to/file
Options: RAILS_ENV=production|development|test - the environment database that the dump file is loaded into (defaults to development)
Examples: rake db:import FILE=db/development_db_name_dump.sql.gz RAILS_ENV=production - first gunzips "development_db_name_dump.sql.gz" - then imports sql file into "production_db_name" database - finally gzips the file back up for the next usage
rake db:import FILE=db/development_db_name_dump.sql RAILS_ENV=test
- imports sql file into "test_db_name" database
- no gunzip or gzip takes place unless given a .gz file
Copyright (c) 2008 Elijah Miller / David Baldwin, released under the MIT license