문제

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?

도움이 되었습니까?

해결책 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'

다른 팁

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'
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top