In the "old days" of Rails (before version 1.0), most people created the databases their apps use directly in SQL, or by using tools like MySQLFront to help them along. This approach has its problems though: how do you know what has changed in the data model between versions of your app? Why do we have to use SQL here when ActiveRecord does a great job of abstracting that away for us? The answer to this came in the form of ActiveRecord migrations. With migrations, you create your database schema in Ruby instead of SQL DDL. If you want to change your data model, say by renaming a column or adding a table, you just write another migration class to do it. Your database keeps track of versioning for you, and you can easily see what changed in the data model just by reading the migration code. It's great, and if you want to learn how to use migrations in your Rails apps, then read on.
How to use migrations:
First you use the Rails generator to create your migration. You can generate just the migration, or you can do it by generating a model, which will also give you a migration file.
discuss this topic to forum