table('acos') ->addColumn('parent_id', 'integer', [ 'default' => null, 'limit' => 10, 'null' => true, ]) ->addColumn('model', 'string', [ 'default' => '', 'limit' => 255, 'null' => true, ]) ->addColumn('foreign_key', 'integer', [ 'default' => null, 'limit' => 10, 'null' => true, ]) ->addColumn('alias', 'string', [ 'default' => '', 'limit' => 255, 'null' => true, ]) ->addColumn('lft', 'integer', [ 'default' => null, 'limit' => 10, 'null' => true, ]) ->addColumn('rght', 'integer', [ 'default' => null, 'limit' => 10, 'null' => true, ]) ->addIndex( [ 'alias', ] ) ->addIndex( [ 'lft', 'rght', ] ) ->create(); $this->table('aros') ->addColumn('parent_id', 'integer', [ 'default' => null, 'limit' => 10, 'null' => true, ]) ->addColumn('model', 'string', [ 'default' => '', 'limit' => 255, 'null' => true, ]) ->addColumn('foreign_key', 'integer', [ 'default' => null, 'limit' => 10, 'null' => true, ]) ->addColumn('alias', 'string', [ 'default' => '', 'limit' => 255, 'null' => true, ]) ->addColumn('lft', 'integer', [ 'default' => null, 'limit' => 10, 'null' => true, ]) ->addColumn('rght', 'integer', [ 'default' => null, 'limit' => 10, 'null' => true, ]) ->addIndex( [ 'alias', ] ) ->addIndex( [ 'lft', 'rght', ] ) ->create(); $this->table('aros_acos') ->addColumn('aro_id', 'integer', [ 'default' => null, 'limit' => 10, 'null' => false, ]) ->addColumn('aco_id', 'integer', [ 'default' => null, 'limit' => 10, 'null' => false, ]) ->addColumn('_create', 'string', [ 'default' => '0', 'limit' => 2, 'null' => false, ]) ->addColumn('_read', 'string', [ 'default' => '0', 'limit' => 2, 'null' => false, ]) ->addColumn('_update', 'string', [ 'default' => '0', 'limit' => 2, 'null' => false, ]) ->addColumn('_delete', 'string', [ 'default' => '0', 'limit' => 2, 'null' => false, ]) ->addIndex( [ 'aco_id', ] ) ->addIndex( [ 'aro_id', ] ) ->create(); $table = $this->table('tests'); $table->addColumn('name', 'string', [ 'default' => null, 'limit' => 255, 'null' => false, ]); $table->create(); $this->getAdapter()->commitTransaction(); $table = TableRegistry::getTableLocator()->get('Tests'); $table->setEntityClass(Test::class); $table->addBehavior('Acl.Acl', ['type' => 'requester']); $entity = $table->newEntity(['name' => 'foo']); $table->save($entity, ['atomic' => false]); $this->getAdapter()->beginTransaction(); } public function down() { $this->table('aros_acos')->drop()->save(); $this->table('aros')->drop()->save(); $this->table('acos')->drop()->save(); $this->table('tests')->drop()->save(); } }