You are currently browsing the tag archive for the 'migrations' tag.

With the imminent release of Rails 2.2, I’ve been spending a lot of time looking at the source code and git checkins. One area where developers will appreciate some small tweaks is migrations.

If you’re not working on a multi-developer team, the default (UTC-based) numbering for migrations is a nuisance. You’ll be able to change that by setting a configuration variable:


config.active_record.timestamped_migrations = false

That will give you the old, integer prefixes instead of the new fancy ones. Once you have those, it becomes easier to edit and re-run a specific migration, thanks to the fact that rake db:migrate:redo now takes an optional VERSION to specify the target migration to redo.

Finally, Rails 2.2 is getting transactional migrations - if you use PostgreSQL. Historically, multiple-step Rails migrations have been a source of trouble. If something went wrong during a migration, everything before the error changed the database and everything after the error wasn’t applied. Also, the migration version was stored as having been executed, which means that it couldn’t be simply rerun by rake db:migrate:redo after you fix the problem. Transactional migrations change this by wrapping migration steps in a DDL transaction, so that if any of them fail, the entire migration is undone.

Next I need to dig into multiple file uploads for a Rails app. This may or may not be fun.

Tomorrow I give my first set of conference talks in a while…3 hours on beginning LSL. Virtually.

Days like today - marked by tedious conference calls and fighting with broken Windows software - make me dream about being in a different business.

SQL Editor is an entity relationship diagram (ERD) tool for OS X with a tie-in to Rails. This might be of interest to folks who want to bring complex database designs into a Rails app, though I think there might be some mismatch there between the idea of big design up front and Rails more agile TDD approach. Anyhow, the idea is that SQL Editor lets you build this:

SQL Editor screenshot

And with a single save operation get this:

Migration screenshot

SQL Editor certainly doesn’t have all the bells and whistles of some of the high-end ERD tools I’ve used under Windows, but for a $69 shareware package it’s serviceable enough. In addition to generating Rails migrations, it can export DDL for MySQL, Postgresql, or Oracle, as well as reverse engineer existing databases via JDBC.

Why “Double Shot”? Why not? My daily links column over at Larkware is called “Daily Grind,” so somehow that just seems to fit. Well, at least as much as anything fits.

  • Shiny new Subversion and Trac cluster - The Rails team has just gotten a server upgrade, and having checked out a new Edge tree last night, I can confirm that it’s a whole lot faster. There’s also a change of URL for the Rails Subversion repository, though the old URL will continue to work. Here’s some info on switching an existing checkout to point to the new URL.
  • Streamlined 0.0.7.1 - I blinked and missed the announcement a few days ago, but the plugin version of this tool for building spiffy Rails views is out now.
  • Show database migration versions with Rake - A simple Rake task to pull the current version out of the database. I imagine this could be useful in a busy shop with multiple devs writing migrations.
  • Site5 Deployment Problems with Capistrano > 1.2 - A fix to some mystery Capistrano permissions problems. I think it’s a feature, but this could still be pretty helpful if you hit the same situation.
  • Getting Started with Subversion on OS X - Ben Wong has some basic information.