This was a big help. Thanks!

One thing though: I couldn't get the newly created migration file to
work initially. I kept getting an error that said "uninitialized
constant CreateDatabase." I had to rename the migration class

So the first line of the migration file is now:
class CreateDatabase < ActiveRecord::Migration

Everything looks good now.

Thanks again.

kevin cline wrote in post #600414:
On Dec 12, 3:22 am, RaSca wrote:
Hi everybody,
i'm a rails newbie and i'm trying to convert an existing application
to rails.
What i cannot find is a way to "convert" an existing mysql database
into a rails migration script.
This can be done in three simple steps:

1. write config/database.yml to reference your database.
2. Run "rake db:schema:dump" to generate db/schema.rb. Here's the

$ rake -T db:schema:dump
rake db:schema:dump # Create a db/schema.rb file that can be
portably used against any DB supported by AR

3. Convert schema.rb into db/migrate/001_create_database.rb:

class CreateMigration < ActiveRecord::Migration
def self.up
# insert schema.rb here

def self.down
# drop all the tables if you really need
# to support migration back to version 0
Posted via

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
For more options, visit

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
postedFeb 6, '13 at 11:23p
activeFeb 6, '13 at 11:23p

1 user in discussion

Joel B.: 1 post



site design / logo © 2021 Grokbase