Skip to content

Commit

Permalink
update for ActiveRecord 2.1 migrations
Browse files Browse the repository at this point in the history
Signed-off-by: Michael S. Klishin <[email protected]>
  • Loading branch information
shayarnett authored and michaelklishin committed Jun 24, 2008
1 parent a94e924 commit f359ed6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ def manifest
m.directory 'schema/migrations'

# Create stubs
highest_migration = Dir[Dir.pwd+'/schema/migrations/*'].map{|f| File.basename(f) =~ /^(\d+)/; $1}.max
filename = format("%03d_%s", (highest_migration.to_i+1), @name.snake_case)
filename = format("%03d_%s", Time.now.utc.strftime("%Y%m%d%H%M%S"), @name.snake_case)
m.template "sessions_migration.erb", "schema/migrations/#{filename}.rb"
puts banner

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ def manifest

m.directory "schema/migrations"

current_migration_number = Dir[Dir.pwd+'/schema/migrations/*'].map{|f| File.basename(f) =~ /^(\d+)/; $1}.max
@migration_file_name = format("%03d_%s", (current_migration_number.to_i+1), model_file_name) + "_migration"
@migration_file_name = format("%03d_%s", Time.now.utc.strftime("%Y%m%d%H%M%S"), model_file_name) + "_migration"

@assigns = { :model_file_name => model_file_name,
:model_attributes => model_attributes,
Expand Down

0 comments on commit f359ed6

Please sign in to comment.