aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/migration.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/migration.rb')
-rw-r--r--activerecord/lib/active_record/migration.rb24
1 files changed, 7 insertions, 17 deletions
diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb
index 4ce276d4bf..22347fcaef 100644
--- a/activerecord/lib/active_record/migration.rb
+++ b/activerecord/lib/active_record/migration.rb
@@ -1,6 +1,5 @@
require "active_support/core_ext/class/attribute_accessors"
require 'set'
-require 'digest/md5'
module ActiveRecord
# Exception that can be raised to stop migrations from going backwards.
@@ -555,10 +554,6 @@ module ActiveRecord
delegate :migrate, :announce, :write, :to => :migration
- def fingerprint
- @fingerprint ||= Digest::MD5.hexdigest(File.read(filename))
- end
-
private
def migration
@@ -729,7 +724,7 @@ module ActiveRecord
raise UnknownMigrationVersionError.new(@target_version) if target.nil?
unless (up? && migrated.include?(target.version.to_i)) || (down? && !migrated.include?(target.version.to_i))
target.migrate(@direction)
- record_version_state_after_migrating(target)
+ record_version_state_after_migrating(target.version)
end
end
@@ -752,7 +747,7 @@ module ActiveRecord
begin
ddl_transaction do
migration.migrate(@direction)
- record_version_state_after_migrating(migration)
+ record_version_state_after_migrating(migration.version)
end
rescue => e
canceled_msg = Base.connection.supports_ddl_transactions? ? "this and " : ""
@@ -810,18 +805,13 @@ module ActiveRecord
raise DuplicateMigrationVersionError.new(version) if version
end
- def record_version_state_after_migrating(target)
+ def record_version_state_after_migrating(version)
if down?
- migrated.delete(target.version)
- ActiveRecord::SchemaMigration.where(:version => target.version.to_s).delete_all
+ migrated.delete(version)
+ ActiveRecord::SchemaMigration.where(:version => version.to_s).delete_all
else
- migrated << target.version
- ActiveRecord::SchemaMigration.create!(
- :version => target.version.to_s,
- :migrated_at => Time.now,
- :fingerprint => target.fingerprint,
- :name => File.basename(target.filename,'.rb').gsub(/^\d+_/,'')
- )
+ migrated << version
+ ActiveRecord::SchemaMigration.create!(:version => version.to_s)
end
end