Despite commit or rollback, the change is "commited" in both cases.
Commit:
START TRANSACTION;
ALTER TABLE `bank` CHANGE COLUMN `bank_active` `bank_activated` BOOLEAN NOT NULL;
COMMIT;
Rollback:
START TRANSACTION;
ALTER TABLE `bank` CHANGE COLUMN `bank_active` `bank_activated` BOOLEAN NOT NULL;
ROLLBACK;
Need to build an automatic updater, that includes database's schema and data updates, and would like to group everything into a transaction, so in case anything goes wrong, just fix the statements and run again.
Is it possible to rollback DDL statements within transactions?
Thank you
BEGIN
in some contexts is the same asSTART TRANSACTION
.phpmyadmin performs one query at a time unless you put the batch in the window for such. Try that.
(And
SET autocommit = 0
is irrelevant because of the explicitSTART
.)Edit
Since the "transaction" really had a DDL statement, my 'answer' is irrelevant.
DDLs cannot be rolled back: https://dev.mysql.com/doc/refman/5.7/en/cannot-roll-back.html