Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create seed file from data already in the database

I'm using Rails 3.0.3 and have data for my "categories" table already in the database, but want to create a seed file from it. Is there any rake task that will generate the seeds.rb format for me from this table?

like image 556
swrobel Avatar asked Dec 08 '10 23:12

swrobel


People also ask

What is data seeding in database?

Data seeding is the process of populating a database with an initial set of data. There are several ways this can be accomplished in EF Core: Model seed data. Manual migration customization. Custom initialization logic.


1 Answers

There is a gem called seed_dump, which will do exactly what you want:

  • https://github.com/rroblak/seed_dump
  • http://rubygems.org/gems/seed_dump
like image 130
John Peterson Avatar answered Oct 03 '22 19:10

John Peterson