dns_project dns_project - 11 months ago 87
MySQL Question

Phinx transaction doesn't work

Trying to figure out how transaction works at phinx package. Here is my migration code and it doesn't work. I use

and everything is ok with
. So table
is created while table
fails and no records are found in
table. So, when I ran
phinx migrate
I've error
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'acme' already exists
. So, how can I use transactions? I didn't find any docs about it, Help me please))

public function up()
$this->table('acme')->addColumn('name', 'string')->create();
$this->table('fail')->addColumn('lal', 'failme')->create();

Answer Source

Transactions only apply to data (DML) changes with mysql. You cannot 'transact' data definition changes (DDL).


But other DBs can (under certain conditions).

Is it possible to roll back CREATE TABLE and ALTER TABLE statements in major SQL databases?