samhuri.net


By Sami J. Samhuri

Intelligent Migration Snippets 0.1 for TextMate

This should be working now. I've tested it under a new user account here.

This does requires the syncPeople bundle to be installed to work. That's ok, because you should get the syncPeople on Rails bundle anyways.

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

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.

See it in action

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.

Download Download Demo Video

Features

There are 3 snippets which are activated by the following tab triggers:

Installation

Run Quick Install.app to install these commands to your <a syncPeople on Rails bundle if it exists, and to the default Rails bundle otherwise. (I highly recommend you get the syncPeople bundle if you haven't already.)

Download Download Intelligent Migration Snippets

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.