Hi All,
This is my first post as in joined just now and have some doubts,
I need a to discuss about Rails migrations in detail,
I have a doubt on doing reverse engineering concept in migrations on
existing database.
Consider, I have deleted all the migration files from the folder
RAILS_ROOT/db/migrate/*.
We have all the tables present in Mysql database. Now, I want to
create a migration files for all existing tables.
Is that possible to create those? If yes, how is it?
Even I have deleted the schema.rb file from RAILS_ROOT/db/ folder.
Looking for solution to try it out.
Thanks in Advance to all the user who is going put their thought
process into it,
-Sathish Kumar
If what you want is a single migration to replace the multiple
migrations you had you can do it but maybe not easily. As Marnen said
you can recreate the schema.rb from the database using an existing rake
task. If you really want a migration you can then bring that file into
any editor and change the syntax line by line to the migration syntax.
It is not hard but just fairly tedious. If you just want to have the
ability to recreate the database, just create the schema.rb (see above)
and save it into your configuration management system. You can fetch
it and run it any time to recreate the current database configuration.