Skip to content

Commit

Permalink
feat(primary key): add missing primary key for phpcr_type_childs (#372)
Browse files Browse the repository at this point in the history
* feat(primary key): add missing primary key for phpcr_type_childs

If settings for percona or strict it requires a primary key on each table. To be backwards compatible we added a primary key on a new field, so there won't be breaking changes.
  • Loading branch information
MichelFalke authored Aug 4, 2020
1 parent 0fb49cd commit e2dbc73
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

1.5.0
-----

* Fix add primary keys to all tables (https://www.percona.com/doc/percona-xtradb-cluster/LATEST/features/pxc-strict-mode.html#tables-without-primary-keys)

1.4.1
-----

Expand Down
8 changes: 8 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Upgrade
=======

1.5
---

- If you want to start using Percona in strict mode, or use the Percona cluster, add a primary key to the phpcr_type_childs:

`ALTER TABLE phpcr_type_childs ADD COLUMN `id` INT(11) UNSIGNED PRIMARY KEY AUTO_INCREMENT FIRST;`


1.2
---

Expand Down
4 changes: 3 additions & 1 deletion src/Jackalope/Transport/DoctrineDBAL/RepositorySchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ protected function addTypePropsTable()
protected function addTypeChildsTable()
{
$childTypes = $this->createTable('phpcr_type_childs');
$childTypes->addColumn('id', 'integer', ['autoincrement' => true]);
$childTypes->addColumn('node_type_id', 'integer');
$childTypes->addColumn('name', 'string');
$childTypes->addColumn('protected', 'boolean');
Expand All @@ -206,6 +207,7 @@ protected function addTypeChildsTable()
$childTypes->addColumn('on_parent_version', 'integer');
$childTypes->addColumn('primary_types', 'string');
$childTypes->addColumn('default_type', 'string', ['notnull' => false]);
$childTypes->setPrimaryKey(['id']);
}

public function reset()
Expand Down Expand Up @@ -241,7 +243,7 @@ private function getMaxIndexLength($currentMaxLength = null)
)) {
return $currentMaxLength;
}

return $this->maxIndexLength;
}

Expand Down

0 comments on commit e2dbc73

Please sign in to comment.