Forum: Ruby on Rails rake migration with transactions.

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Mathias Stjernström (Guest)
on 2006-02-14 18:03
(Received via mailing list)
I use migrations to handle my database scheme and i put all actions
between a transaction block like this .

execute "BEGIN work;"
execute "CREATE TABLE table1 (xxx);"
execute "CREATE TABLE table2 (xxx);"
execute "CREATE TABLE table3 (xxx);"
execute "COMMIT work;"

I do this because if 'create table2' fails, the process is aborted
but table 1 is still created.

Are there an easier way of doing this,
do i miss something obvious in migrations that does this by default?


This topic is locked and can not be replied to.