<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-11593374.post464482304449274445..comments</id><updated>2010-03-29T20:42:55.315+01:00</updated><category term='firefox'/><category term='Mobile'/><category term='Gaming'/><category term='Leadership'/><category term='Trac'/><category term='Agile'/><category term='Ruby'/><category term='Subversion'/><category term='Linux'/><category term='Thunderbird'/><category term='Shopping'/><category term='Spring'/><category term='Apache'/><category term='Windows'/><category term='Java'/><category term='Blog'/><category term='Web'/><category term='Guitar'/><title type='text'>Comments on Andrew Beacock's Blog: How to rollback Rails database migrations</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.andrewbeacock.com/feeds/464482304449274445/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default'/><link rel='alternate' type='text/html' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html'/><author><name>Andy B</name><uri>http://www.blogger.com/profile/01039992884679308726</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://bp0.blogger.com/_Vu_eUOpUOMk/RgWamJV19TI/AAAAAAAAAGw/Lu_6ZKf-Glw/s400/buddy_icon.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-11593374.post-1076712171385572039</id><published>2010-03-29T20:42:55.306+01:00</published><updated>2010-03-29T20:42:55.306+01:00</updated><title type='text'>Cheers for your updated code, this migration rollb...</title><content type='html'>Cheers for your updated code, this migration rollback code is not intended for the date-based versioning (this wasn&amp;#39;t available at the time of the original post).&lt;br /&gt;&lt;br /&gt;I don&amp;#39;t work with Rails anymore so thank you for the correction! :)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/1076712171385572039'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/1076712171385572039'/><link rel='alternate' type='text/html' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html?showComment=1269891775306#c1076712171385572039' title=''/><author><name>Andy B</name><uri>http://www.blogger.com/profile/01039992884679308726</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://bp0.blogger.com/_Vu_eUOpUOMk/RgWamJV19TI/AAAAAAAAAGw/Lu_6ZKf-Glw/s400/buddy_icon.png'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html' ref='tag:blogger.com,1999:blog-11593374.post-464482304449274445' source='http://www.blogger.com/feeds/11593374/posts/default/464482304449274445' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-401133037'/></entry><entry><id>tag:blogger.com,1999:blog-11593374.post-4367527695925807641</id><published>2010-03-29T20:35:21.266+01:00</published><updated>2010-03-29T20:35:21.266+01:00</updated><title type='text'>I had problems with the code.  The current_version...</title><content type='html'>I had problems with the code.  The current_version.to_i - 1 took the current version and just did a minus one.  so 20100329180520 became 20100329180519 which is not what is desired.  I&amp;#39;ve made some changes to the code that use the rollback method instead. &lt;br /&gt;&lt;br /&gt;namespace :db do&lt;br /&gt;  namespace :migrate do&lt;br /&gt;    desc &amp;quot;Rollback the database schema to the previous version&amp;quot;&lt;br /&gt;    task :rollback =&amp;gt; :environment do&lt;br /&gt;      ActiveRecord::Migrator.rollback(&amp;quot;db/migrate/&amp;quot;)&lt;br /&gt;      previous_version= ActiveRecord::Migrator.current_version.to_i&lt;br /&gt;      puts &amp;quot;Schema rolled back to previous verison (#{previous_version}).&amp;quot;&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;end</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/4367527695925807641'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/4367527695925807641'/><link rel='alternate' type='text/html' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html?showComment=1269891321266#c4367527695925807641' title=''/><author><name>anuaimi</name><uri>http://www.blogger.com/profile/17825407057685100021</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html' ref='tag:blogger.com,1999:blog-11593374.post-464482304449274445' source='http://www.blogger.com/feeds/11593374/posts/default/464482304449274445' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1902585385'/></entry><entry><id>tag:blogger.com,1999:blog-11593374.post-3558958782327502140</id><published>2009-10-21T09:22:57.764+01:00</published><updated>2009-10-21T09:22:57.764+01:00</updated><title type='text'>Puneet, again thanks for the info!  I&amp;#39;ve not p...</title><content type='html'>Puneet, again thanks for the info!  I&amp;#39;ve not played with Rails for nearly two years now (I changed jobs) so it&amp;#39;s good to get advice on how it&amp;#39;s changed since I wrote these posts back in 2007.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/3558958782327502140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/3558958782327502140'/><link rel='alternate' type='text/html' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html?showComment=1256113377764#c3558958782327502140' title=''/><author><name>Andy B</name><uri>http://www.blogger.com/profile/01039992884679308726</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://bp0.blogger.com/_Vu_eUOpUOMk/RgWamJV19TI/AAAAAAAAAGw/Lu_6ZKf-Glw/s400/buddy_icon.png'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html' ref='tag:blogger.com,1999:blog-11593374.post-464482304449274445' source='http://www.blogger.com/feeds/11593374/posts/default/464482304449274445' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-401133037'/></entry><entry><id>tag:blogger.com,1999:blog-11593374.post-8857141004852317702</id><published>2009-10-21T09:18:54.434+01:00</published><updated>2009-10-21T09:18:54.434+01:00</updated><title type='text'>Also, it should be pointed out that this only work...</title><content type='html'>Also, it should be pointed out that this only works with the sequential migration numbering which I suppose, was used in older rails versions.&lt;br /&gt;&lt;br /&gt;If your rails version use timestamp based naming of migrations, you can add the following to your environment.rb to force usage of sequential migration numbers.&lt;br /&gt;&lt;br&gt;&lt;br /&gt;&lt;b&gt;config.active_record.timestamped_migrations = false&lt;/b&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/8857141004852317702'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/8857141004852317702'/><link rel='alternate' type='text/html' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html?showComment=1256113134434#c8857141004852317702' title=''/><author><name>Puneet</name><uri>http://www.blogger.com/profile/16212266980352677080</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html' ref='tag:blogger.com,1999:blog-11593374.post-464482304449274445' source='http://www.blogger.com/feeds/11593374/posts/default/464482304449274445' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1442606160'/></entry><entry><id>tag:blogger.com,1999:blog-11593374.post-3972398253151257499</id><published>2009-10-21T09:12:05.525+01:00</published><updated>2009-10-21T09:12:05.525+01:00</updated><title type='text'>Cheers Puneet, I&amp;#39;ll update it now!</title><content type='html'>Cheers Puneet, I&amp;#39;ll update it now!</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/3972398253151257499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/3972398253151257499'/><link rel='alternate' type='text/html' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html?showComment=1256112725525#c3972398253151257499' title=''/><author><name>Andy B</name><uri>http://www.blogger.com/profile/01039992884679308726</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://bp0.blogger.com/_Vu_eUOpUOMk/RgWamJV19TI/AAAAAAAAAGw/Lu_6ZKf-Glw/s400/buddy_icon.png'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html' ref='tag:blogger.com,1999:blog-11593374.post-464482304449274445' source='http://www.blogger.com/feeds/11593374/posts/default/464482304449274445' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-401133037'/></entry><entry><id>tag:blogger.com,1999:blog-11593374.post-639208091954830643</id><published>2009-10-20T20:19:13.976+01:00</published><updated>2009-10-20T20:19:13.976+01:00</updated><title type='text'>Thanks for this tip.
Just a minor point, you are m...</title><content type='html'>Thanks for this tip.&lt;br /&gt;Just a minor point, you are missing an &amp;quot;end&amp;quot; towards the end of your script.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/639208091954830643'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/639208091954830643'/><link rel='alternate' type='text/html' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html?showComment=1256066353976#c639208091954830643' title=''/><author><name>Puneet</name><uri>http://www.blogger.com/profile/16212266980352677080</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html' ref='tag:blogger.com,1999:blog-11593374.post-464482304449274445' source='http://www.blogger.com/feeds/11593374/posts/default/464482304449274445' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1442606160'/></entry><entry><id>tag:blogger.com,1999:blog-11593374.post-511447968703701579</id><published>2009-08-23T03:42:33.579+01:00</published><updated>2009-08-23T03:42:33.579+01:00</updated><title type='text'>rake db:migrate:down VERSION=20090326173033
might ...</title><content type='html'>rake db:migrate:down VERSION=20090326173033&lt;br /&gt;might help</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/511447968703701579'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/511447968703701579'/><link rel='alternate' type='text/html' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html?showComment=1250995353579#c511447968703701579' title=''/><author><name>Roger Pack</name><uri>http://www.blogger.com/profile/01578246846716577925</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html' ref='tag:blogger.com,1999:blog-11593374.post-464482304449274445' source='http://www.blogger.com/feeds/11593374/posts/default/464482304449274445' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-2000749021'/></entry><entry><id>tag:blogger.com,1999:blog-11593374.post-7249118341486038808</id><published>2008-01-28T12:49:00.000Z</published><updated>2008-01-28T12:49:00.000Z</updated><title type='text'>Paul, you can also just use "2" as your version nu...</title><content type='html'>Paul, you can also just use "2" as your version number as Rails equates "002" as "2" internally anyway.&lt;BR/&gt;&lt;BR/&gt;Glad you found my post some use though! :)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/7249118341486038808'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/7249118341486038808'/><link rel='alternate' type='text/html' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html?showComment=1201524540000#c7249118341486038808' title=''/><author><name>abeacock</name><uri>http://www.blogger.com/profile/01039992884679308726</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://bp0.blogger.com/_Vu_eUOpUOMk/RgWamJV19TI/AAAAAAAAAGw/Lu_6ZKf-Glw/s400/buddy_icon.png'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html' ref='tag:blogger.com,1999:blog-11593374.post-464482304449274445' source='http://www.blogger.com/feeds/11593374/posts/default/464482304449274445' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-401133037'/></entry><entry><id>tag:blogger.com,1999:blog-11593374.post-3544052490493192470</id><published>2008-01-27T23:29:00.000Z</published><updated>2008-01-27T23:29:00.000Z</updated><title type='text'>Useful info.  I managed to rollback using "rake db...</title><content type='html'>Useful info.  I managed to rollback using "rake db:migrate VERSION=002" where the current version was named "003_add_test_data.rb" and the previous version named "002_add_price.rb".  Thanks for the help.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/3544052490493192470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/3544052490493192470'/><link rel='alternate' type='text/html' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html?showComment=1201476540000#c3544052490493192470' title=''/><author><name>Paul Clarke</name><uri>http://www.blogger.com/profile/13653648834292453696</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html' ref='tag:blogger.com,1999:blog-11593374.post-464482304449274445' source='http://www.blogger.com/feeds/11593374/posts/default/464482304449274445' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-571644730'/></entry><entry><id>tag:blogger.com,1999:blog-11593374.post-8848884236700123824</id><published>2008-01-20T14:01:00.000Z</published><updated>2008-01-20T14:01:00.000Z</updated><title type='text'>I tried a :&lt;br&gt;"rake db:migrate VERSION=X" to see ...</title><content type='html'>I tried a :&lt;BR/&gt;"rake db:migrate VERSION=X" to see what it did ..."&lt;BR/&gt;&lt;BR/&gt;It removed all my my database tables&lt;BR/&gt;&lt;BR/&gt;DON'T DO IT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/8848884236700123824'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/8848884236700123824'/><link rel='alternate' type='text/html' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html?showComment=1200837660000#c8848884236700123824' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html' ref='tag:blogger.com,1999:blog-11593374.post-464482304449274445' source='http://www.blogger.com/feeds/11593374/posts/default/464482304449274445' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-403377447'/></entry><entry><id>tag:blogger.com,1999:blog-11593374.post-4863246019692633345</id><published>2007-12-13T11:12:00.000Z</published><updated>2007-12-13T11:12:00.000Z</updated><title type='text'>Behold, for I am become a cow, the mo-oer of world...</title><content type='html'>Behold, for I am become a cow, the mo-oer of worlds.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/4863246019692633345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11593374/464482304449274445/comments/default/4863246019692633345'/><link rel='alternate' type='text/html' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html?showComment=1197544320000#c4863246019692633345' title=''/><author><name>Ravin Dave D</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.andrewbeacock.com/2007/12/how-to-rollback-rails-database.html' ref='tag:blogger.com,1999:blog-11593374.post-464482304449274445' source='http://www.blogger.com/feeds/11593374/posts/default/464482304449274445' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-704807115'/></entry></feed>
