Permalink
Browse files

Merge pull request #13355 from dylanahsmith/migration-version

activerecord: Initialize Migration with version from MigrationProxy.

Conflicts:
	activerecord/CHANGELOG.md

Conflicts:
	activerecord/CHANGELOG.md
  • Loading branch information...
rafaelfranca committed Jan 7, 2014
1 parent 2051231 commit 33073463e4479aff7952a7c390c2f6584cf67269
@@ -1,3 +1,8 @@
+* Initialize version on Migration objects so that it can be used in a migration,
+ and it will be included in the announce message.
+
+ *Dylan Thacker-Smith*
+
* Fixed ActiveRecord::Store nil conversion TypeError when using YAML coder.
In case the YAML passed as paramter is nil, uses an empty string.
@@ -720,7 +720,7 @@ def migration
def load_migration
require(File.expand_path(filename))
- name.constantize.new
+ name.constantize.new(name, version)
end
end
@@ -76,6 +76,10 @@ def test_migrator_versions
assert_equal true, ActiveRecord::Migrator.needs_migration?
end
+ def test_migration_version
+ ActiveRecord::Migrator.run(:up, MIGRATIONS_ROOT + "/version_check", 20131219224947)
+ end
+
def test_create_table_with_force_true_does_not_drop_nonexisting_table
if Person.connection.table_exists?(:testings2)
Person.connection.drop_table :testings2
@@ -0,0 +1,8 @@
+class MigrationVersionCheck < ActiveRecord::Migration
+ def self.up
+ raise "incorrect migration version" unless version == 20131219224947
+ end
+
+ def self.down
+ end
+end

0 comments on commit 3307346

Please sign in to comment.