From c00de99f69358b58ca2bd6bc732e2de1b667800e Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 28 Mar 2008 21:21:01 +0000 Subject: Switched to UTC-timebased version numbers for migrations and the schema. This will as good as eliminate the problem of multiple migrations getting the same version assigned in different branches. Also added rake db:migrate:up/down to apply individual migrations that may need to be run when you merge branches (closes #11458) [jbarnette] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9122 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/lib/rails_generator/commands.rb | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'railties/lib/rails_generator/commands.rb') diff --git a/railties/lib/rails_generator/commands.rb b/railties/lib/rails_generator/commands.rb index 2f65918796..f74ca7722b 100644 --- a/railties/lib/rails_generator/commands.rb +++ b/railties/lib/rails_generator/commands.rb @@ -69,19 +69,8 @@ module Rails not existing_migrations(file_name).empty? end - def current_migration_number - Dir.glob("#{RAILS_ROOT}/#{@migration_directory}/[0-9]*_*.rb").inject(0) do |max, file_path| - n = File.basename(file_path).split('_', 2).first.to_i - if n > max then n else max end - end - end - - def next_migration_number - current_migration_number + 1 - end - def next_migration_string(padding = 3) - "%.#{padding}d" % next_migration_number + Time.now.utc.strftime("%Y%m%d%H%M%S") end def gsub_file(relative_destination, regexp, *args, &block) -- cgit v1.2.3