diff options
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/generators/migration.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/migration.rb b/railties/lib/rails/generators/migration.rb index 9244307261..8d98909055 100644 --- a/railties/lib/rails/generators/migration.rb +++ b/railties/lib/rails/generators/migration.rb @@ -53,7 +53,11 @@ module Rails destination = self.class.migration_exists?(migration_dir, @migration_file_name) if behavior == :invoke - raise Error, "Another migration is already named #{@migration_file_name}: #{destination}" if destination + if destination && options.force? + remove_file(destination) + elsif destination + raise Error, "Another migration is already named #{@migration_file_name}: #{destination}" + end destination = File.join(migration_dir, "#{@migration_number}_#{@migration_file_name}.rb") end |