https://github.com/ryanberliner/rails-csv-seed
Ruby on Rails task to backup all database records into csv files, and a seeds file to import those same records (say, as another user after checkout from version control).
https://github.com/ryanberliner/rails-csv-seed
backup csv-backup csv-files database-record ruby-on-rails seed
Last synced: 2 months ago
JSON representation
Ruby on Rails task to backup all database records into csv files, and a seeds file to import those same records (say, as another user after checkout from version control).
- Host: GitHub
- URL: https://github.com/ryanberliner/rails-csv-seed
- Owner: RyanBerliner
- Created: 2017-09-18T13:12:16.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-10-24T02:27:47.000Z (over 7 years ago)
- Last Synced: 2025-01-19T16:49:13.868Z (over 1 year ago)
- Topics: backup, csv-backup, csv-files, database-record, ruby-on-rails, seed
- Language: Ruby
- Homepage:
- Size: 1.95 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rails CSV Seed
These files will allow you to backup your current database records into a csv files, and then run a database seed to import them.
## How to use:
1. copy and paste seeds.rb contents into db/seeds.rb
2. place csv_backup.rake into lib/tasks/
3. run 'rails csv_backup' in the terminal. this will put all your db records into csv files (one for each table) in db/csv_backups/
4. to seed with your backed up data, run rails db:seed
Snippets taken from all over the internet, handy when you have complex relationships and a lot of data because you can take a snapshot, check it into version control, and then import or re-seed without worrying about validations. You could easily modify to allow different seed sets like a 'dev' seed, a 'presentation' seed, stuff like that.