Monday, January 30, 2006

Are migrations executed within a transaction?

[Rails] Are migrations executed within a transaction?

As I'm writing migration changes to the database, I find that rollingback is a pain sometimes, because of writing self.down(). When it fails, I have to reset the database. While this really isn't a problem since no real data is in there (and all the fixtures are added automatically), it is an extra step.

I figured migrations would be executed within a transaction, but apparently, it's not. This was the only link I could find about it, and the guy just says you can't. Anyone know why you can't?

1 comment:

  1. I'm not a DB expert. But I don't imagine that modifying table structures is something that can be rolled back. It's not the same as inserting new data into a table.

    Thus, no transaction. Maybe if you looked up the definition of the ACID properties for a transcations, it would make sense that modifying a table structure does not follow those properties, and thus does not qualify to be a transaction.