We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is a (multiple allowed):
bug
enhancement
feature-discussion (RFC)
CakePHP Version: 3.6.11
Migrations plugin version: 2.0.0
Database server: Postgres 9.5.13
PHP Version: 7.2.9
Platform / OS: Ubuntu 16.04 LTS
Insert data in the up() function. Here a small example:
<?php use Cake\ORM\TableRegistry; use Migrations\AbstractMigration; class CreateTest extends AbstractMigration { public function up() { $table = $this->table('tests'); $table->addColumn('name', 'string', [ 'default' => null, 'limit' => 255, 'null' => false, ]); $table->create(); $table = TableRegistry::getTableLocator()->get('Tests'); $entity = $table->newEntity(['name' => 'foo']); $table->save($entity); } public function down() { $this->table('tests')->drop()->save(); } }
Note: this code work in migrations v1.7.2
Creation of table: tests and insertion of 'foo'
Exception: There is no active transaction in [/.../vendor/cakephp/cakephp/src/Database/Driver.php, line 197]
This work:
$table->save($entity, ['atomic' => false]);
But this wont:
$table = TableRegistry::getTableLocator()->get('Tests'); $table->addBehavior('Acl.Acl', ['type' => 'requester']); $entity = $table->newEntity(['name' => 'foo']); $table->save($entity, ['atomic' => false]);
$this->getAdapter()->commitTransaction(); $table = TableRegistry::getTableLocator()->get('Tests'); $table->addBehavior('Acl.Acl', ['type' => 'requester']); $entity = $table->newEntity(['name' => 'foo']); $table->save($entity, ['atomic' => false]); $this->getAdapter()->beginTransaction();
The full working example file: 20180926072527_CreateTest.php.txt
The text was updated successfully, but these errors were encountered:
I had similar issue when using the seed feature for postgresql. Using your workaround works. So thanks!
But I thought this was fixed by #91. So /cc @lorenzo
Sorry, something went wrong.
Workaround for postgres (see cakephp/migrations#370)
0b4a987
Same bug is on Microsoft SQL server but there are no alternatives from above working.
9ef4cbc
966ac56
No branches or pull requests
This is a (multiple allowed):
bug
enhancement
feature-discussion (RFC)
CakePHP Version: 3.6.11
Migrations plugin version: 2.0.0
Database server: Postgres 9.5.13
PHP Version: 7.2.9
Platform / OS: Ubuntu 16.04 LTS
What you did
Insert data in the up() function.
Here a small example:
Note: this code work in migrations v1.7.2
Expected Behavior
Creation of table: tests and insertion of 'foo'
Actual Behavior
Exception: There is no active transaction in [/.../vendor/cakephp/cakephp/src/Database/Driver.php, line 197]
Alternatives
This work:
But this wont:
This work:
The full working example file:
20180926072527_CreateTest.php.txt
The text was updated successfully, but these errors were encountered: