Phinx 交易不起作用
Phinx transaction doesn't work
试图找出 t运行saction 在 phinx 包中的工作原理。这是我的迁移代码,它不起作用。我使用 mysql
,phinx.yml
一切正常。因此 table acme
被创建,而 table fail
失败并且在 phinxlog
table 中找不到任何记录。所以,当我 运行 phinx migrate
我有错误 SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'acme' already exists
。那么,我该如何使用 t运行sactions?我没有找到任何关于它的文档,请帮助我))
public function up()
{
$this->getAdapter()->beginTransaction();
$this->table('acme')->addColumn('name', 'string')->create();
$this->table('fail')->addColumn('lal', 'failme')->create();
$this->getAdapter()->commitTransaction();
}
事务仅适用于 mysql 的数据 (DML) 更改。您不能 'transact' 数据定义更改 (DDL)。
http://dev.mysql.com/doc/refman/5.7/en/cannot-roll-back.html
但其他数据库可以(在特定条件下)。
Is it possible to roll back CREATE TABLE and ALTER TABLE statements in major SQL databases?
试图找出 t运行saction 在 phinx 包中的工作原理。这是我的迁移代码,它不起作用。我使用 mysql
,phinx.yml
一切正常。因此 table acme
被创建,而 table fail
失败并且在 phinxlog
table 中找不到任何记录。所以,当我 运行 phinx migrate
我有错误 SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'acme' already exists
。那么,我该如何使用 t运行sactions?我没有找到任何关于它的文档,请帮助我))
public function up()
{
$this->getAdapter()->beginTransaction();
$this->table('acme')->addColumn('name', 'string')->create();
$this->table('fail')->addColumn('lal', 'failme')->create();
$this->getAdapter()->commitTransaction();
}
事务仅适用于 mysql 的数据 (DML) 更改。您不能 'transact' 数据定义更改 (DDL)。
http://dev.mysql.com/doc/refman/5.7/en/cannot-roll-back.html
但其他数据库可以(在特定条件下)。
Is it possible to roll back CREATE TABLE and ALTER TABLE statements in major SQL databases?