You will have to unpick the changes that were made by hand.
Migrations are stored in files in timestamp identifying the migration followed by an underscore followed by the name of the migration.
Rails provides a set of rake tasks to work with migrations which boils down to running certain sets of migrations.
This migration will already contain instructions for creating the relevant table.
If you tell Rails what columns you want then statements for adding those will also be created.
If you specify a target version, Active Record will run the required migrations (up or down) until it has reached the specified version.
The version is the numerical prefix on the migration’s filename.
A migration creating a table and adding an index might produce output like this will suppress any output.
When creating or updating data in a migration it is often tempting to use one of your models.If you have already run the migration then you cannot just edit the migration and run the migration again: Rails thinks it has already run the migration and so will do nothing when you run to run the corrected version.In general editing existing migrations is not a good idea: you will be creating extra work for yourself and your co-workers and cause major headaches if the existing version of the migration has already been run on production machines.by hand but you would then be responsible for telling other developers that they need to go and run it.You’d also have to keep track of which changes need to be run against the production machines next time you deploy.The migration class’ name must match (the camelcased version of) the latter part of the file name.