Transactions does not work on structure creations / modifications?

4

I was searching the internet for some way to run Transactions for operations of type ALTER TABLE or CREATE TABLE in Mysql . This is because in a system of ours, we used Migrations and wanted that, if something went wrong in creating the table, the changes had a rollback.

I ended up finding that can not do this in Mysql.

I saw this in SOEN's Answer .

(If someone can translate, be grateful, but could understand more or less).

  

Some statements can not be rolled back. In general, these include data definition language (DDL) statements, such as those that create or drop databases, those that create, drop, or alter tables or stored routines.

But then there were some doubts:

  • Why is there such a limitation on structural table changes?

asked by anonymous 22.06.2016 / 16:43

1 answer

2

According to documentation of MySQL it talks, in general, DDL (create, alter, drop, trucante) are not supported inside transactions, because their execution causes a commit of implicita or once the statement is executed your application is done in the bank on time in case of success.

Typically the concept of transaction is applied to the manipulation (make / break) of the data, some banks allow some DDL in transitions as this answer .

    
22.06.2016 / 17:25