# Add 2 Records with Migrations. No errors. No new records

**URL:** <https://www.ruby-forum.com/t/add-2-records-with-migrations-no-errors-no-new-records/62129>\
**Category:** Rails\
**Created:** [May 31, 2006, 8:21pm UTC](https://www.ruby-forum.com/t/add-2-records-with-migrations-no-errors-no-new-records/62129 "2006-05-31T20:21:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwigal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6a8cbe/32.png) [@jwigal](https://www.ruby-forum.com/u/jwigal)\
**Post date:** [May 31, 2006, 8:21pm UTC](https://www.ruby-forum.com/t/add-2-records-with-migrations-no-errors-no-new-records/62129/1 "2006-05-31T20:21:50Z")

</div>

I have created the following migrationg by using:  
“ruby script/generate migration AddFirst”

But when I run: “rake migrate” it doesn’t add these two records. I don’t  
get  
any errors. The schema\_info table is created and schema.rb is updated  
with  
“:version =\> 1”.

Can I not create records this way? When I load up script/console and put  
in  
the same code, it will create the records just fine. The Account and  
User  
model are already created.

# /db/migrate/001\_add\_first.rb

class AddFirst \< ActiveRecord::Migration  
def self.up  
Account.create :name =\> “Company Inc.”, :domain =\> “localhost”,  
:subdomain =\> “”  
User.create :name =\> “Administrator”, :username =\> “admin”,  
:password =\>  
“1234”, :email =\> “removed\_email\_address@domain.invalid”, :account\_id =\> 1  
end

def self.down  
end  
end

---

<div class="post-metadata">

**Author:** ![jwigal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6a8cbe/32.png) [@jwigal](https://www.ruby-forum.com/u/jwigal)\
**Post date:** [May 31, 2006, 8:50pm UTC](https://www.ruby-forum.com/t/add-2-records-with-migrations-no-errors-no-new-records/62129/2 "2006-05-31T20:50:23Z")

</div>

Do you have tables for accounts and users already?  
(thats first migration so I assume you have created them by hand)

---

<div class="post-metadata">

**Author:** ![jwigal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6a8cbe/32.png) [@jwigal](https://www.ruby-forum.com/u/jwigal)\
**Post date:** [May 31, 2006, 8:56pm UTC](https://www.ruby-forum.com/t/add-2-records-with-migrations-no-errors-no-new-records/62129/3 "2006-05-31T20:56:54Z")

</div>

Yes, I have created them in schema.rb.

---

<div class="post-metadata">

**Author:** ![jwigal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6a8cbe/32.png) [@jwigal](https://www.ruby-forum.com/u/jwigal)\
**Post date:** [May 31, 2006, 9:40pm UTC](https://www.ruby-forum.com/t/add-2-records-with-migrations-no-errors-no-new-records/62129/4 "2006-05-31T21:40:28Z")

</div>

You should create tables via migrations. To my knowledge schema.rb is  
just for showing the current schema. Migrations edit schema.rb, you  
should not.

---

<div class="post-metadata">

**Author:** ![jwigal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6a8cbe/32.png) [@jwigal](https://www.ruby-forum.com/u/jwigal)\
**Post date:** [May 31, 2006, 10:15pm UTC](https://www.ruby-forum.com/t/add-2-records-with-migrations-no-errors-no-new-records/62129/5 "2006-05-31T22:15:18Z")

</div>

Okay, I knew in that Migrations video that “running with scissors”  
wasn’t a  
good idea.

So, in my first migration I am creating all my initial tables. In the  
second  
migration I add my 2 records. I run rake migrate and it runs migration  
one  
and two and all is well.

Thanks,

Jeff
