<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,7 @@
 *Edge*
 
+* db:migrate:down and :up update schema_migrations.  #369 [Michael Raidel, RaceCondition]
+
 * PostgreSQL: support :conditions =&gt; [':foo::integer', { :foo =&gt; 1 }] without treating the ::integer typecast as a bind variable.  [Tarmo T&#228;nav]
 
 * MySQL: rename_column preserves column defaults.  #466 [Diego Algorta]</diff>
      <filename>activerecord/CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -399,7 +399,10 @@ module ActiveRecord
     def run
       target = migrations.detect { |m| m.version == @target_version }
       raise UnknownMigrationVersionError.new(@target_version) if target.nil?
-      target.migrate(@direction)
+      unless (up? &amp;&amp; migrated.include?(target.version.to_i)) || (down? &amp;&amp; !migrated.include?(target.version.to_i))
+        target.migrate(@direction)
+        record_version_state_after_migrating(target.version)
+      end
     end
 
     def migrate</diff>
      <filename>activerecord/lib/active_record/migration.rb</filename>
    </modified>
    <modified>
      <diff>@@ -825,6 +825,21 @@ if ActiveRecord::Base.connection.supports_migrations?
       assert !Reminder.table_exists?
     end
 
+    def test_migrator_double_up
+      assert_equal(0, ActiveRecord::Migrator.current_version)
+      ActiveRecord::Migrator.run(:up, MIGRATIONS_ROOT + &quot;/valid&quot;, 1)
+      assert_nothing_raised { ActiveRecord::Migrator.run(:up, MIGRATIONS_ROOT + &quot;/valid&quot;, 1) }
+      assert_equal(1, ActiveRecord::Migrator.current_version)
+    end
+
+    def test_migrator_double_down
+      assert_equal(0, ActiveRecord::Migrator.current_version)
+      ActiveRecord::Migrator.run(:up, MIGRATIONS_ROOT + &quot;/valid&quot;, 1)
+      ActiveRecord::Migrator.run(:down, MIGRATIONS_ROOT + &quot;/valid&quot;, 1)
+      assert_nothing_raised { ActiveRecord::Migrator.run(:down, MIGRATIONS_ROOT + &quot;/valid&quot;, 1) }
+      assert_equal(0, ActiveRecord::Migrator.current_version)
+    end
+
     def test_finds_migrations
       migrations = ActiveRecord::Migrator.new(:up, MIGRATIONS_ROOT + &quot;/valid&quot;).migrations
       [['1', 'people_have_last_names'],
@@ -914,16 +929,6 @@ if ActiveRecord::Base.connection.supports_migrations?
       ActiveRecord::Migrator.rollback(MIGRATIONS_ROOT + &quot;/valid&quot;)
       assert_equal(0, ActiveRecord::Migrator.current_version)
     end
-    
-    def test_migrator_run
-      assert_equal(0, ActiveRecord::Migrator.current_version)
-      ActiveRecord::Migrator.run(:up, MIGRATIONS_ROOT + &quot;/valid&quot;, 3)
-      assert_equal(0, ActiveRecord::Migrator.current_version)
-
-      assert_equal(0, ActiveRecord::Migrator.current_version)
-      ActiveRecord::Migrator.run(:down, MIGRATIONS_ROOT + &quot;/valid&quot;, 3)
-      assert_equal(0, ActiveRecord::Migrator.current_version)
-    end
 
     def test_schema_migrations_table_name
       ActiveRecord::Base.table_name_prefix = &quot;prefix_&quot;</diff>
      <filename>activerecord/test/cases/migration_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1afae84ab2656cd58a861ab4a4b1745d80088d0f</id>
    </parent>
  </parents>
  <author>
    <name>Michael Raidel</name>
    <email>raidel@induktiv.at</email>
  </author>
  <url>http://github.com/rails/rails/commit/f94600bdaf7d73971ad9a53148b0844c2efb901d</url>
  <id>f94600bdaf7d73971ad9a53148b0844c2efb901d</id>
  <committed-date>2008-06-22T18:16:17-07:00</committed-date>
  <authored-date>2008-06-13T07:14:07-07:00</authored-date>
  <message>ActiveRecord::Migrator#run records version-state after migrating.  [#369 state:resolved]</message>
  <tree>12be24df5ae0336cb8b1c9d4a6f4882b007e6e78</tree>
  <committer>
    <name>Jeremy Kemper</name>
    <email>jeremy@bitsweat.net</email>
  </committer>
</commit>
