Skip to content
/ csv_db Public

backup a db table to a csv or push csv content to a db table

Notifications You must be signed in to change notification settings

phongsi/csv_db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

csv_db

is a gem for rails apps that adds to rake db tasks. The command rake db:csv_to_db pushes csv content to a db table and the command rake db:db_to_csv pulls a database table into a csv

Install

gem install csv_db

Usage

If you have a table you want to backup into a csv in the rails db with a model: Model

just call: rake db:csv_to_db model=Model

the call writes into a csv file Model.csv located in the app root directory

If you have data you want to push from a csv in the rails db with a model: Model

just call: rake db:db_to_csv csv=Model

the call reads from a csv file Model.csv located in the app root directory

the top row of the csv should be the column names delimited by commas

remember to place files in the right place. also primary keys cannot be written.

About

backup a db table to a csv or push csv content to a db table

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages