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

**URL:** <https://www.ruby-forum.com/t/schema-rb-gotcha-and-how-to-load-default-entries-in-db/148254>\
**Category:** Rails\
**Created:** [September 11, 2008, 12:04am UTC](https://www.ruby-forum.com/t/schema-rb-gotcha-and-how-to-load-default-entries-in-db/148254 "2008-09-11T00:04:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [September 11, 2008, 12:04am UTC](https://www.ruby-forum.com/t/schema-rb-gotcha-and-how-to-load-default-entries-in-db/148254/1 "2008-09-11T00:04:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [September 11, 2008, 12:10am UTC](https://www.ruby-forum.com/t/schema-rb-gotcha-and-how-to-load-default-entries-in-db/148254/2 "2008-09-11T00:10:23Z")

</div>

Hi,

On Wed, Sep 10, 2008 at 3:04 PM, Fernando P.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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](http://www.intridea.com/2008/4/20/seed-fu-simple-seed-data-for-rails)

~ j.

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [September 11, 2008, 12:16am UTC](https://www.ruby-forum.com/t/schema-rb-gotcha-and-how-to-load-default-entries-in-db/148254/3 "2008-09-11T00:16:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [September 18, 2008, 1:53pm UTC](https://www.ruby-forum.com/t/schema-rb-gotcha-and-how-to-load-default-entries-in-db/148254/4 "2008-09-18T13:53:11Z")

</div>

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.
