# Can't read my MySQL Tables

**URL:** <https://www.ruby-forum.com/t/cant-read-my-mysql-tables/83130>\
**Category:** Rails\
**Created:** [January 23, 2007, 8:40pm UTC](https://www.ruby-forum.com/t/cant-read-my-mysql-tables/83130 "2007-01-23T20:40:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![james\_027](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4af34b/32.png) [@james\_027](https://www.ruby-forum.com/u/james_027)\
**Post date:** [January 23, 2007, 8:40pm UTC](https://www.ruby-forum.com/t/cant-read-my-mysql-tables/83130/1 "2007-01-23T20:40:00Z")

</div>

hi,

I am trying to create a new model by ruby script/model Personnel. But  
when I look into the personnel.rb there are no fields generated. Where  
should I check this problem?

Thanks

---

<div class="post-metadata">

**Author:** ![james\_027](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4af34b/32.png) [@james\_027](https://www.ruby-forum.com/u/james_027)\
**Post date:** [January 23, 2007, 9:43pm UTC](https://www.ruby-forum.com/t/cant-read-my-mysql-tables/83130/2 "2007-01-23T21:43:20Z")

</div>

> I am trying to create a new model by ruby script/model Personnel. But  
> when I look into the personnel.rb there are no fields generated. Where  
> should I check this problem?

There won’t be any fields in the model file. Rails looks at your  
database table and figures out the structure dynamically.

There should be a migration file to create a database table - you can  
specify columns there. And then look in mysql at the table you  
created.

---

<div class="post-metadata">

**Author:** ![james\_027](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4af34b/32.png) [@james\_027](https://www.ruby-forum.com/u/james_027)\
**Post date:** [January 24, 2007, 1:42am UTC](https://www.ruby-forum.com/t/cant-read-my-mysql-tables/83130/3 "2007-01-24T01:42:02Z")

</div>

Thanks toby, I try to generate a scaffold and everything went well.

What will be the purpose of specifying columns in the migration file?

james

---

<div class="post-metadata">

**Author:** ![james\_027](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4af34b/32.png) [@james\_027](https://www.ruby-forum.com/u/james_027)\
**Post date:** [January 24, 2007, 2:25am UTC](https://www.ruby-forum.com/t/cant-read-my-mysql-tables/83130/4 "2007-01-24T02:25:08Z")

</div>

Migrations are a way for Rails to create the tables for you if you do  
not already have them.

Very handy if you are starting from scratch, working with others or  
need to make schema changes during deployment/upgrades (especially when  
using Capistrano).

Since migrations exist within Rails they have access to all you  
models/etc, so manipulating the data can be scripted and the logic  
captured.

---

<div class="post-metadata">

**Author:** ![james\_027](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4af34b/32.png) [@james\_027](https://www.ruby-forum.com/u/james_027)\
**Post date:** [January 24, 2007, 4:39am UTC](https://www.ruby-forum.com/t/cant-read-my-mysql-tables/83130/5 "2007-01-24T04:39:20Z")

</div>

Thanks askegg. Very well explain
