Title: Intelligent Migration Snippets 0.1 for TextMate
Date: February 22, 2006
Timestamp: 1140607680
Author: sjs
Tags: mac os x, textmate, rails, hacking, migrations, snippets
----


  <a href="http://web.archive.org/web/20060321041227/http://sami.samhuri.net/admin/content/edit/23" class="admintools" id="admin_article" style="display: none;">edit</a>
  <h2>Intelligent Migration Snippets 0.1 for TextMate</h2>
  <p class="auth"><!-- Posted by <a href="mailto:sjs@uvic.ca">Sami Jensen Samhuri</a> -->
  <span class="typo_date" title="Wed, 22 Feb 2006 11:28:00 GMT">on Wednesday, February 22, 2006</span></p>
  <p><em><strong>This should be working now. I’ve tested it under a new user account here.</strong></em></p>


	<p><em>This does requires the syncPeople bundle to be installed to work. That’s ok, because you should get the <a href="http://web.archive.org/web/20060321041227/http://blog.inquirylabs.com/">syncPeople on Rails</a> bundle anyways.</em></p>


	<p>&nbsp;</p>


	<p>When writing database migrations in Ruby on Rails it is common to create a table in the <code>self.up</code> method and then drop it in <code>self.down</code>. The same goes for adding, removing and renaming columns.</p>


	<p>I wrote a Ruby program to insert code into both methods with a single snippet. All the TextMate commands and macros that you need are included.</p>


	<h3>See it in action</h3>


	<p>I think this looks cool in action. Plus I like to show off what what TextMate can do to people who may not use it, or don’t have a Mac. It’s just over 30 seconds long and weighs in at around 700kb.</p>


	<p style="text-align: center;"><img src="./Intelligent Migration Snippets 0.1 for TextMate - samhuri.net_files/download.png" title="Download" alt="Download"> <a href="http://web.archive.org/web/20060321041227/http://sami.samhuri.net/files/ims-demo.mov">Download Demo Video</a></p>


	<h3>Features</h3>


	<p>There are 3 snippets which are activated by the following tab triggers:</p>


	<ul>
	<li><strong>mcdt</strong>: Migration Create and Drop Table</li>
		<li><strong>marc</strong>: Migration Add and Remove Column</li>
		<li><strong>mnc</strong>: Migration Rename Column</li>
	</ul>


	<h3>Installation</h3>


	<p>Run <strong>Quick Install.app</strong> to install these commands to your <a href="http://web.archive.org/web/20060321041227/http://blog.inquirylabs.com/">syncPeople on Rails bundle</a> if it exists, and to the default Rails bundle otherwise. (I highly recommend you get the syncPeople bundle if you haven’t already.)</p>


	<p style="text-align: center;"><img src="./Intelligent Migration Snippets 0.1 for TextMate - samhuri.net_files/download.png" title="Download" alt="Download"> <a href="http://web.archive.org/web/20060321041227/http://sami.samhuri.net/files/IntelligentMigrationSnippets-0.1.dmg">Download Intelligent Migration Snippets</a></p>


	<p>This is specific to Rails migrations, but there are probably other uses for something like this. You are free to use and distribute this code.</p>

