Reputation: 21
I'm now working on a legacy Ruby on Rails project. I found the previous owner of this project exported data from Sqlite3 data tables to separate .yml files. Now I want to import these data from .yml files to their corresponding data tables, but didn't figure out how. The problem can be describe as:
Under the 'db' folder of Ruby on Rails 3 project root folder, there is a 'backup' folder that stores all the .yml files.
(Rails 3 root folder)=>db=>backup=>(all the *.yml files)
Each .yml file corresponds to a data table in the database. For example, suppose I have a 'users' table, then I have a 'users.yml' file that stores several user data as the seeds.
The .yml file content is like:
name: user1
title: SE1
location: loc1
name: user2
title: SE2
location: loc2
If there anyone can help on this issue? Thanks in advance!
Upvotes: 1
Views: 2028
Reputation: 11736
Most likely he used yaml_db gem. You can use
gem install yaml_db
rake db:data:load_dir dir='backup'
to load your data if that is the case.
Upvotes: 1