Permalink
Browse files

Added extra comment when a migration already exists of the same name.

User should know that he can overwrite the previous migration. This
comes in handy especially when generating models which were previously
created then removed.
  • Loading branch information...
1 parent 9d023c8 commit b4c99ea0a4d7e5223fa1b21cdb9301f9d090dbfe @wangjohn wangjohn committed Feb 15, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 railties/lib/rails/generators/migration.rb
@@ -52,7 +52,7 @@ def migration_template(source, destination=nil, config={})
if destination && options.force?
remove_file(destination)
elsif destination
- raise Error, "Another migration is already named #{@migration_file_name}: #{destination}"
+ raise Error, "Another migration is already named #{@migration_file_name}: #{destination}. Use --force to remove the old migration file and replace it."
end
destination = File.join(migration_dir, "#{@migration_number}_#{@migration_file_name}.rb")
end

1 comment on commit b4c99ea

Is there a way to just silently skip the migration if this is the case? I'm attempting to add new migrations from an updated Rails engine gem I'm building.

Stackoverflow question: http://stackoverflow.com/questions/15671099/add-new-migrations-from-rails-engine-gem-to-app-via-generator

Please sign in to comment.