diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-03-01 11:39:39 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-03-05 16:12:08 +0100 |
commit | b337390889cb4a9f80ed08daf072a043f0e7ddf3 (patch) | |
tree | 896987ee08707fd2c09579bc9f0732674a9ba53d /guides | |
parent | f1241ef959a45d1b66e2e9399a3e1b09cf95cc2c (diff) | |
download | rails-b337390889cb4a9f80ed08daf072a043f0e7ddf3.tar.gz rails-b337390889cb4a9f80ed08daf072a043f0e7ddf3.tar.bz2 rails-b337390889cb4a9f80ed08daf072a043f0e7ddf3.zip |
transactions can be turned off per Migration.
Closes #9483.
There are SQL Queries that can't run inside a transaction. Since
the Migrator used to wrap all Migrations inside a transaction there
was no way to run these queries within a migration.
This patch adds `self.disable_ddl_transaction!` to the migration to
turn transactions off when necessary.
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/migrations.md | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/guides/source/migrations.md b/guides/source/migrations.md index 89ae564c24..bd63970bea 100644 --- a/guides/source/migrations.md +++ b/guides/source/migrations.md @@ -61,6 +61,10 @@ migrations are wrapped in a transaction. If the database does not support this then when a migration fails the parts of it that succeeded will not be rolled back. You will have to rollback the changes that were made by hand. +NOTE: There are certain queries that can't run inside a transaction. If your +adapter supports DDL transactions you can use `disable_ddl_transaction!` to +disable them for a single migration. + If you wish for a migration to do something that Active Record doesn't know how to reverse, you can use `reversible`: @@ -180,7 +184,7 @@ end ``` If the migration name is of the form "CreateXXX" and is -followed by a list of column names and types then a migration creating the table +followed by a list of column names and types then a migration creating the table XXX with the columns listed will be generated. For example: ```bash |