Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documents #81

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ All rake tasks will then be available to you.

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).

rake db:data:dump_dir -> Dump contents of database to curr_dir_name/tablename.extension (defaults to yaml)
rake db:data:load_dir -> Load contents of db/data_dir into database
rake db:data:dump_dir -> Dump contents of database to db/<data_dir>/<tablename>.<extension> (defaults to yaml)
rake db:data:load_dir -> Load contents of db/<data_dir> into database

Default `<data_dir>` is `%F_%T` (see Ruby's Time#strftime). And we can change `<data_dir>` by `dir` parameter.

rake db:data:dump_dir dir=before_exciting_migrations -> Dump contents of database to db/before_exciting_migrations/<tablename>.<extension>
rake db:data:load_dir dir=before_exciting_migrations -> Load contents of db/before_exciting_migrations/ into database

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.

Expand Down