Skip to content

Commit

Permalink
fix #4762
Browse files Browse the repository at this point in the history
  • Loading branch information
Guite committed Dec 6, 2021
1 parent aff872b commit 3705824
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-3.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- [Admin] Add missing numeric casts to admin module setting usages (#4709).
- [Extensions] Fixed non-working extension modification actions (#4768).
- [Groups] Fix some non-working translations (#4694).
- [Groups] Rename database tables for improved PostgreSQL compatibilty (#4762).
- [Menu] Fixed handling of menu items without URI in custom request voter.
- [Search] Add missing query string to search results pagination.
- [Theme] Asset combination now defaults to `false` on installation (#4419).
Expand Down
2 changes: 1 addition & 1 deletion src/system/GroupsModule/Entity/GroupApplicationEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* GroupApplication entity class.
*
* @ORM\Entity(repositoryClass="Zikula\GroupsModule\Entity\Repository\GroupApplicationRepository")
* @ORM\Table(name="group_applications")
* @ORM\Table(name="zikula_groups_application")
*/
class GroupApplicationEntity extends EntityAccess
{
Expand Down
2 changes: 1 addition & 1 deletion src/system/GroupsModule/Entity/GroupEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* Group entity class.
*
* @ORM\Entity(repositoryClass="Zikula\GroupsModule\Entity\Repository\GroupRepository")
* @ORM\Table(name="`groups`")
* @ORM\Table(name="zikula_groups_group")
*/
class GroupEntity extends EntityAccess
{
Expand Down
42 changes: 42 additions & 0 deletions src/system/GroupsModule/EventListener/Core3UpgradeListener.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Zikula package.
*
* Copyright Zikula - https://ziku.la/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Zikula\GroupsModule\EventListener;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Zikula\Bundle\CoreBundle\Doctrine\ColumnExistsTrait;
use Zikula\Bundle\CoreInstallerBundle\Event\CoreUpgradePreExtensionUpgrade;

class Core3UpgradeListener implements EventSubscriberInterface
{
use ColumnExistsTrait;

public static function getSubscribedEvents()
{
return [
CoreUpgradePreExtensionUpgrade::class => 'upgrade'
];
}

public function upgrade(CoreUpgradePreExtensionUpgrade $event): void
{
if (!version_compare($event->getCurrentCoreVersion(), '3.1.0', '<')) {
return;
}
$sm = $this->conn->getSchemaManager();
if ($sm->tablesExist(['groups'])) {
$sql = 'RENAME TABLE `groups` TO `zikula_groups_group`, `group_applications` TO `zikula_groups_application`;';
$this->conn->executeQuery($sql);
}
}
}

0 comments on commit 3705824

Please sign in to comment.