Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 390
- Log:
Initial import of Canvass, a donations-based poll application.
- Author:
- rool
- Date:
- Mon Mar 21 14:58:04 +0000 2011
- Size:
- 2727 Bytes
1 | # YamlDb |
2 | |
3 | YamlDb is a database-independent format for dumping and restoring data. It complements the the database-independent schema format found in db/schema.rb. The data is saved into db/data.yml. |
4 | |
5 | This can be used as a replacement for mysqldump or pg_dump, but only for the databases typically used by Rails apps. Users, permissions, schemas, triggers, and other advanced database features are not supported - by design. |
6 | |
7 | Any database that has an ActiveRecord adapter should work. |
8 | |
9 | ## Installation |
10 | |
11 | This plugin can now be installed as a gem via |
12 | |
13 | gem install yaml_db |
14 | |
15 | Note that when doing this, the rake tasks won't automatically be available to your app. You'll have to explicitly include them via the approaches followed: [here](http://ggr.com/how-to-include-a-gems-rake-tasks-in-your-rails-app.html), [here](https://rails.lighthouseapp.com/projects/8994/tickets/510-rake-tasks-not-included-for-gems), [and here](https://rails.lighthouseapp.com/projects/8994/tickets/59) |
16 | |
17 | ## Usage |
18 | |
19 | rake db:data:dump -> Dump contents of Rails database to db/data.yml |
20 | rake db:data:load -> Load contents of db/data.yml into the database |
21 | |
22 | Further, there are tasks db:dump and db:load which do the entire database (the equivalent of running db:schema:dump followed by db:data:load). Also, there are other tasks recently added that allow the export of the database contents to/from multiple files (each one named after the table being dumped or loaded). |
23 | |
24 | rake db:data:dump_dir -> Dump contents of database to curr_dir_name/tablename.extension (defaults to yaml) |
25 | rake db:data:load_dir -> Load contents of db/data_dir into database |
26 | |
27 | In addition, we have plugins whereby you can export your database to/from various formats. We only deal with yaml and csv right now, but you can easily write tools for your own formats (such as Excel or XML). To use another format, just load setting the "class" parameter to the class you are using. This defaults to "YamlDb::Helper" which is a refactoring of the old yaml_db code. We'll shorten this to use class nicknames in a little bit. |
28 | |
29 | ## Examples |
30 | |
31 | One common use would be to switch your data from one database backend to another. For example, let's say you wanted to switch from SQLite to MySQL. You might execute the following steps: |
32 | |
33 | 1. rake db:dump |
34 | |
35 | 2. Edit config/database.yml and change your adapter to mysql, set up database params |
36 | |
37 | 3. mysqladmin create [database name] |
38 | |
39 | 4. rake db:load |
40 | |
41 | ## Credits |
42 | |
43 | Created by Orion Henry and Adam Wiggins. Major updates by Ricardo Chimal, Jr. |
44 | |
45 | Patches contributed by Michael Irwin, Tom Locke, and Tim Galeckas. |
46 | |
47 | Send questions, feedback, or patches to the Heroku mailing list: http://groups.google.com/group/heroku |
48 |