The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
migreazy

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Francis Hwang

Posts: 130
Nickname: francis
Registered: Jul, 2004

Francis Hwang is the Director of Technology at Rhizome.org.
migreazy Posted: May 13, 2009 6:32 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Francis Hwang.
Original Post: migreazy
Feed Title: Francis Hwang's site: ruby
Feed URL: http://fhwang.net/syndicate/ruby.atom
Feed Description: Author & artist Francis Hwang's personal site.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Francis Hwang
Latest Posts From Francis Hwang's site: ruby

Advertisement

“It ain’t easy bein’ greazy in a world full of cleanliness.” —Method Man

migreazy is a tool that helps manage git branches and Rails migrations.

http://github.com/fhwang/migreazy/tree/master

Right now it support three actions:

Diff

Diff will compare two sets of migrations and tell you what the differences are.

Show the differences between my development DB and the git branch called my_branch:

$ migreazy diff my_branch

Show the differences between my development DB and my working copy:

$ migreazy diff

Show the differences between the git branches master and my_branch:

$ migreazy diff master my_branch

Down

Down will apply down migrations to get your development DB to be a suitable state so you can switch branches. For example, let’s say you have the branch “master” and the branch “my_branch”, with the following migrations (using the old-fashioned migration numbers for purposes of illustration):

mastermy_branch
11
2
3

If you’re working in “my_branch”, your development DB will have migrations 1 and 2, but not 3. If for some reason you have to go back to “master” to do a quick bugfix or something, you can do this:

$ migreazy down master  # this rolls back migration 2
$ git checkout master
$ rake db:migrate       # this runs migration 3

Find

Find takes a migration number as an argument and digs through your git branches to see which branches contain this migration.

$ migreazy find 20090512132032

This can come in handy if you do a ton of branching and then occasionally make the mistake of switching a branch without first migrating down from that branch’s migrations.

For example, let’s say you’re in master but you’re getting test failures that you think are being caused by having your migrations out of sync. Here’s how you might fix that:

$ migreazy diff
Missing in development DB:
  (none)

Missing in working copy:
  20090512132032
$ migreazy find 20090512132032
Migration 20090512132032 found in my_branch
$ git checkout my_branch
$ migreazy down master

Read: migreazy

Topic: Interview: Author Jeremy McAnally Previous Topic   Next Topic Topic: Less PHP, more Ruby

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use