Question

I have been using YamlDb to save the state of my database. And use the rake task to dump the contents of Rails database to db/data.yml

rake db:data:dump

I also use the rake task to load the contents of db/data.yml into the database at times.

rake db:data:load

I am not sure if this has been asked before, but is there anyway to Dump one or two selected tables as oppose to the entire DB? if so how?

Was it helpful?

Solution 2

If anyone wants to be able to dump/load individual tables with yaml_db on Rails 4.

You can use this gem

gem 'yaml_db', :git => 'git://github.com/ballin22s/yaml_db.git'

OTHER TIPS

I looked into the YamlDb gem and it was a simple change to modify the rake task to include an argument which takes a parameter of table name. I've forked the repo and made the necessary changes here. I'll work on getting the changes merged into the gem but for now you can add this repo to your Gemfile like this:

gem 'yamldb', :git => 'https://github.com/Ploonky/yaml_db.git'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top