-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
50 lines (35 loc) · 1.87 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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