<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -625,6 +625,12 @@ If the action is nil, return all views for the controller.&quot;
     (when (search-backward-regexp &quot;^[ ]*def \\([a-z0-9_]+\\)&quot; nil t)
       (match-string-no-properties 1))))
 
+(defun rails-core:current-migration-version ()
+  &quot;Return the current migration version&quot;
+  (let ((name (buffer-file-name)))
+    (when (string-match &quot;db\\/migrate\\/\\([0-9]+\\)[a-z0-9_]+\.[a-z]+$&quot; name)
+      (match-string 1 name))))
+
 ;;;;;;;;;; Determination of buffer type ;;;;;;;;;;
 
 (defun rails-core:buffer-file-match (regexp)</diff>
      <filename>rails-core.el</filename>
    </modified>
    <modified>
      <diff>@@ -94,6 +94,38 @@
      (when (&lt; 2  (length versions))
        (nth 1 versions)))))
 
+(defun rails-rake:migrate-version (&amp;optional version direction)
+  &quot;Run the db:migration:(up|down) task&quot;
+  (interactive)
+  (if (string-equal &quot;&quot; version)
+      (setq version (rails-core:current-migration-version)))
+  (rails-rake:task
+   (concat
+    &quot;db:migrate&quot;
+    (cond ((string-equal direction &quot;up&quot;) &quot;:up&quot;)
+          ((string-equal direction &quot;down&quot;) &quot;:down&quot;))
+    (typecase version
+      (integer (format &quot; VERSION=%.3i&quot; version))
+      (string (format &quot; VERSION=%s&quot; version))))))
+
+(defun rails-rake:migration-version-up (&amp;optional version)
+  &quot;Run up migration with VERSION.&quot;
+  (interactive (rails-completing-read &quot;Version of migration&quot;
+                                      (rails-core:migration-versions t)
+                                      nil
+                                      t))
+  (when version
+    (rails-rake:migrate-version version &quot;up&quot;)))
+
+(defun rails-rake:migration-version-down (&amp;optional version)
+  &quot;Run up migration with VERSION.&quot;
+  (interactive (rails-completing-read &quot;Version of migration&quot;
+                                      (rails-core:migration-versions t)
+                                      nil
+                                      t))
+  (when version
+    (rails-rake:migrate-version version &quot;down&quot;)))
+
 ;; This function was originally defined anonymously in ui. It was defined here so keys
 ;; can be added to it dryly
 (defun rails-rake:clone-development-db-to-test-db ()</diff>
      <filename>rails-rake.el</filename>
    </modified>
    <modified>
      <diff>@@ -288,6 +288,8 @@
   ((rails-key &quot;\C-c d m&quot;) 'rails-rake:migrate)
   ((rails-key &quot;\C-c d v&quot;) 'rails-rake:migrate-to-version)
   ((rails-key &quot;\C-c d p&quot;) 'rails-rake:migrate-to-prev-version)
+  ((rails-key &quot;\C-c d u&quot;) 'rails-rake:migration-version-up)
+  ((rails-key &quot;\C-c d d&quot;) 'rails-rake:migration-version-down)
   ((rails-key &quot;\C-c d t&quot;) 'rails-rake:clone-development-db-to-test-db)
 
   ;; Tests</diff>
      <filename>rails-ui.el</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1aa98f24bccb47af167a35b4ccbdfda477ad0c57</id>
    </parent>
  </parents>
  <author>
    <name>crazycode</name>
    <email>crazycode@gmail.com</email>
  </author>
  <url>http://github.com/remvee/emacs-rails/commit/0ad15ce2fc5b507de738c533c8f8e55e4617b949</url>
  <id>0ad15ce2fc5b507de738c533c8f8e55e4617b949</id>
  <committed-date>2009-06-17T15:55:19-07:00</committed-date>
  <authored-date>2009-06-17T15:55:19-07:00</authored-date>
  <message>merge migration change from sishen/emacs-rails.</message>
  <tree>4131c078826505db1b2c0e7d800539ff55a418cf</tree>
  <committer>
    <name>crazycode</name>
    <email>crazycode@gmail.com</email>
  </committer>
</commit>
