From 02da4abbd6110bdf3ab645f36527101f7b0031f7 Mon Sep 17 00:00:00 2001 From: Yuya.Nishida Date: Mon, 17 Aug 2009 17:55:05 +0900 Subject: [PATCH] Unify `migration number' in `migration version' (except CHANGELOG) --- activerecord/lib/active_record/base.rb | 2 +- railties/guides/source/migrations.textile | 2 +- railties/lib/generators/migration.rb | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index c5be561..5fdb54f 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -539,7 +539,7 @@ module ActiveRecord #:nodoc: ## # :singleton-method: - # Specify whether or not to use timestamps for migration numbers + # Specify whether or not to use timestamps for migration versions cattr_accessor :timestamped_migrations , :instance_writer => false @@timestamped_migrations = true diff --git a/railties/guides/source/migrations.textile b/railties/guides/source/migrations.textile index 5f49ac4..d589a4f 100644 --- a/railties/guides/source/migrations.textile +++ b/railties/guides/source/migrations.textile @@ -84,7 +84,7 @@ 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 have to 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 version (the timestamp) to identify them. Prior to Rails 2.1 the migration version 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+. The combination of timestamps and recording which migrations have been run allows Rails to handle common situations that occur with multiple developers. diff --git a/railties/lib/generators/migration.rb b/railties/lib/generators/migration.rb index 0a9151e..f201334 100644 --- a/railties/lib/generators/migration.rb +++ b/railties/lib/generators/migration.rb @@ -2,7 +2,7 @@ module Rails module Generators # Holds common methods for migrations. It assumes that migrations has the # [0-9]*_name format and can be used by another frameworks (like Sequel) - # just by implementing the next migration number method. + # just by implementing the next migration version method. # module Migration def self.included(base) #:nodoc: @@ -12,10 +12,10 @@ module Rails end # Creates a migration template at the given destination. The difference - # to the default template method is that the migration number is appended - # to the destination file name. + # to the default template method is that the migration version is + # appended to the destination file name. # - # The migration number, migration file name, migration class name are + # The migration version, migration file name, migration class name are # available as instance variables in the template to be rendered. # # ==== Examples -- 1.6.3.3