aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorNik Wakelin <nik@codetocustomer.com>2008-07-17 02:50:29 +0100
committerPratik Naik <pratiknaik@gmail.com>2008-07-17 02:54:45 +0100
commitbbab6391366f59189e84d2b8de2a63bea91a9851 (patch)
treeb7fa5e6df063451e017ee78c4a10d0c128c135e4 /activerecord
parentd8a72b32c5b0c32abf257f05b89bad7d21f178ec (diff)
downloadrails-bbab6391366f59189e84d2b8de2a63bea91a9851.tar.gz
rails-bbab6391366f59189e84d2b8de2a63bea91a9851.tar.bz2
rails-bbab6391366f59189e84d2b8de2a63bea91a9851.zip
Set config.active_record.timestamped_migrations = false to have migrations with numeric prefix instead of UTC timestamp. [#446 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG2
-rwxr-xr-xactiverecord/lib/active_record/base.rb4
-rw-r--r--activerecord/lib/active_record/migration.rb16
3 files changed, 22 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index 95fdd93f65..90be9b700a 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*Edge*
+* Set config.active_record.timestamped_migrations = false to have migrations with numeric prefix instead of UTC timestamp. #446. [Andrew Stone, Nik Wakelin]
+
* change_column_default preserves the not-null constraint. #617 [Tarmo Tänav]
* Fixed that create database statements would always include "DEFAULT NULL" (Nick Sieger) [#334]
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index a75e1a5b24..4f5d72a0be 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -439,6 +439,10 @@ module ActiveRecord #:nodoc:
cattr_accessor :schema_format , :instance_writer => false
@@schema_format = :ruby
+ # Specify whether or not to use timestamps for migration numbers
+ cattr_accessor :timestamped_migrations , :instance_writer => false
+ @@timestamped_migrations = true
+
# Determine whether to store the full constant name including namespace when using STI
superclass_delegating_accessor :store_full_sti_class
self.store_full_sti_class = false
diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb
index e095b3c766..731a350854 100644
--- a/activerecord/lib/active_record/migration.rb
+++ b/activerecord/lib/active_record/migration.rb
@@ -238,6 +238,22 @@ module ActiveRecord
# lower than the current schema version: when migrating up, those
# never-applied "interleaved" migrations will be automatically applied, and
# when migrating down, never-applied "interleaved" migrations will be skipped.
+ #
+ # == Timestamped Migrations
+ #
+ # By default, Rails generates migrations that look like:
+ #
+ # 20080717013526_your_migration_name.rb
+ #
+ # The prefix is a generation timestamp (in UTC).
+ #
+ # If you'd prefer to use numeric prefixes, you can turn timestamped migrations
+ # off by setting:
+ #
+ # config.active_record.timestamped_migrations = false
+ #
+ # In environment.rb.
+ #
class Migration
@@verbose = true
cattr_accessor :verbose