Froze rails gems
[depot.git] / vendor / rails / railties / doc / guides / source / migrations / index.txt
1 Migrations
2 ==========
3
4 Migrations are a convenient way for you to alter your database in a structured and organised manner. You could edit fragments of SQL 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. Active Record tracks which migrations have already been run so all you have to do is update your source and run `rake db:migrate`. Active Record will work out which migrations should be run.
5
6 Migrations also allow you to describe these transformations using Ruby. The great thing about this is that (like most of Active Record's functionality) it is database independent: you don't need to worry about the precise syntax of CREATE TABLE any more that you worry about variations on SELECT * (you can drop down to raw SQL for database specific features). For example you could use SQLite3 in development, but MySQL in production.
7
8 You'll learn all about migrations including:
9
10 * The generators you can use to create them
11 * The methods Active Record provides to manipulate your database
12 * The Rake tasks that manipulate them
13 * How they relate to `schema.rb`
14
15 include::anatomy_of_a_migration.txt[]
16 include::creating_a_migration.txt[]
17 include::writing_a_migration.txt[]
18 include::rakeing_around.txt[]
19 include::using_models_in_migrations.txt[]
20 include::scheming.txt[]
21 include::foreign_keys.txt[]
22 include::changelog.txt[]