Create migration files in rails from existing mysql table?
- Start by referencing your existing MySQL database in database.yml
- run
rake db:schema:dump
to generate the schema.rb file - Paste the
create_table
methods from your schema.rb into a new migration, and Voila!
ruby script/generate migration Tabledata
migration file inside add the schema.rb
remove this line
1)ActiveRecord::Schema.define(:version => 0) do
end
2)rake db:migrate
Comments
Post a Comment