I'm just learning Rails and have begun the section on database migrations. I built 2 migrations and both migrated up successfully. Migrating down, the latest migration, the one that runs first, failed because of a typo in my code. I fixed the typo but the migration continued to fail after that. I discovered the reason why was that the migrating down aborted half way through changes and then when I tried to migrate down again it failed because some of the changes had already been made and so column names were different and other issues like that. I ended up fixing it by fiddling with the schema_migrations
table and manually rolling back my changes to a previous version and then migrating back up and down from there.
My question is, is there a way to tell Rails to run migrations in transaction mode and if the code fails, not to commit the transaction?