aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/rails/generators
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/rails/generators')
-rw-r--r--activerecord/lib/rails/generators/active_record.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/rails/generators/active_record.rb b/activerecord/lib/rails/generators/active_record.rb
index 1ca838b4f2..d2b1e86857 100644
--- a/activerecord/lib/rails/generators/active_record.rb
+++ b/activerecord/lib/rails/generators/active_record.rb
@@ -19,10 +19,11 @@ module ActiveRecord
# Implement the required interface for Rails::Generators::Migration.
#
def self.next_migration_number(dirname) #:nodoc:
+ next_migration_number = current_migration_number(dirname) + 1
if ActiveRecord::Base.timestamped_migrations
- Time.now.utc.strftime("%Y%m%d%H%M%S")
+ [Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
else
- "%.3d" % (current_migration_number(dirname) + 1)
+ "%.3d" % next_migration_number
end
end
end