Forum: Ruby on Rails Auto-generate database schema based upon model?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
B9e9b6442f78306456efa03b11b00610?d=identicon&s=25 rhodebump (Guest)
on 2007-01-22 01:40
(Received via mailing list)
>From my research, it appears that I have to manually create database
tables.  I was wondering if there is a gem or something else in ROR
that would auto-create the database for me based upon my ruby model.

70ca58d0e0e0eabbdb74d177417d09d7?d=identicon&s=25 (Guest)
on 2007-01-22 03:31
(Received via mailing list)
The fields themselves won't be auto created, but when you do
./script/generate model model_name, you'll also get a db migration file
generated for ya.
0997b06e37474faf021df5764626112a?d=identicon&s=25 Joe at CodeGear (Guest)
on 2007-01-22 14:13
(Received via mailing list)
You have to manually create the empty db yourself (eg mysqladmin create

When you generate the model an empty migration is created in
db\migrate.  Edit this to define the table columns and then run rake

Read about migrations, much nicer than hand coding sql scripts.
This topic is locked and can not be replied to.