aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/migrations.textile
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-05-09 13:02:55 +0300
committerJosé Valim <jose.valim@gmail.com>2010-05-09 13:02:55 +0300
commit06eaf27fffbd4e24c038ea40ee8d118b5b4f04df (patch)
tree113859f95a9fae7c67138f746da997fd9e91a2d2 /railties/guides/source/migrations.textile
parent6c2d974e152850b533dafc6654d0df7bddfbd4bf (diff)
parente1a0d86fe0355ddff8c86db0f42f3824ffe14c02 (diff)
downloadrails-06eaf27fffbd4e24c038ea40ee8d118b5b4f04df.tar.gz
rails-06eaf27fffbd4e24c038ea40ee8d118b5b4f04df.tar.bz2
rails-06eaf27fffbd4e24c038ea40ee8d118b5b4f04df.zip
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'railties/guides/source/migrations.textile')
-rw-r--r--railties/guides/source/migrations.textile8
1 files changed, 6 insertions, 2 deletions
diff --git a/railties/guides/source/migrations.textile b/railties/guides/source/migrations.textile
index 6f88ed6b3f..f05c0589b5 100644
--- a/railties/guides/source/migrations.textile
+++ b/railties/guides/source/migrations.textile
@@ -82,9 +82,13 @@ On databases that support transactions with statements that change the schema (s
h4. What's in a Name
-Migrations are stored in files in +db/migrate+, one for each migration class. The name of the file is of the form +YYYYMMDDHHMMSS_create_products.rb+, that is to say a UTC timestamp identifying the migration followed by an underscore followed by the name of the migration. The migration class' name must match (the camelcased version of) the latter part of the file name. For example +20080906120000_create_products.rb+ should define +CreateProducts+ and +20080906120001_add_details_to_products.rb+ should define +AddDetailsToProducts+. If you do feel the need to change the file name then you <em>have to</em> update the name of the class inside or Rails will complain about a missing class.
+Migrations are stored in files in +db/migrate+, one for each migration class. The name of the file is of the form +YYYYMMDDHHMMSS_create_products.rb+, that is to say a UTC timestamp identifying the migration followed by an underscore followed by the name of the migration. The name of the migration class (CamelCased version) should match the latter part of the file name. For example +20080906120000_create_products.rb+ should define +CreateProducts+ and +20080906120001_add_details_to_products.rb+ should define +AddDetailsToProducts+. If you do feel the need to change the file name then you <em>have to</em> update the name of the class inside or Rails will complain about a missing class.
-Internally Rails only uses the migration's number (the timestamp) to identify them. Prior to Rails 2.1 the migration number started at 1 and was incremented each time a migration was generated. With multiple developers it was easy for these to clash requiring you to rollback migrations and renumber them. With Rails 2.1 this is largely avoided by using the creation time of the migration to identify them. You can revert to the old numbering scheme by setting +config.active_record.timestamped_migrations+ to +false+ in +config/environment.rb+.
+Internally Rails only uses the migration's number (the timestamp) to identify them. Prior to Rails 2.1 the migration number started at 1 and was incremented each time a migration was generated. With multiple developers it was easy for these to clash requiring you to rollback migrations and renumber them. With Rails 2.1 this is largely avoided by using the creation time of the migration to identify them. You can revert to the old numbering scheme by adding the following line to +config/application.rb+.
+
+<ruby>
+config.active_record.timestamped_migrations = false
+</ruby>
The combination of timestamps and recording which migrations have been run allows Rails to handle common situations that occur with multiple developers.