Schema.rb gotcha and how to load default entries in DB

Hi list,

I just wanted to let you know:

  1. Yes you must check in the schema.rb into your SCM.
  2. Yes you must use db:schema:load
  3. Be careful schema.rb won’t allow you to load “default” entries into
    the DB

My question is, if I want to have for instance a default user inserted
into DB such as an admin user, how do you handle that? Mixing migrations
and schema.rb is dangerous.

Hi,

On Wed, Sep 10, 2008 at 3:04 PM, Fernando P.
[email protected] wrote:

My question is, if I want to have for instance a default user inserted
into DB such as an admin user, how do you handle that? Mixing migrations
and schema.rb is dangerous.

Have you looked at seed-fu?

http://www.intridea.com/2008/4/20/seed-fu-simple-seed-data-for-rails

~ j.

Thank you that’s the kind of plugin I was looking for!

Just to let you know: be extremely CAREFUL with rake db:schema:load.

If you run it by mistake on production server, it cleans up the DB. I
tried that whem my rake db:migrate didn’t want to make the new changes
go live, and I discovered I had reset the whole DB.