Permalink
Browse files

activerecord: Initialize Migration with version from MigrationProxy.

  • Loading branch information...
dylanahsmith committed Dec 17, 2013
1 parent f2b80a4 commit 06ace1e2b5cdccf67ff969ff0d355fd87f46dcf0
@@ -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.
@@ -759,7 +759,7 @@ def migration
def load_migration
require(File.expand_path(filename))
- name.constantize.new
+ name.constantize.new(name, version)
end
end
@@ -79,6 +79,10 @@ def test_migrator_versions
ActiveRecord::Migrator.migrations_paths = old_path
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 06ace1e

Please sign in to comment.