Skip to content

Commit

Permalink
fix migration and installer
Browse files Browse the repository at this point in the history
  • Loading branch information
solverat committed Aug 27, 2024
1 parent 9c00838 commit eda153f
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
4 changes: 4 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Upgrade Notes

## 3.1.3
- **[ENHANCEMENT]** Allow no auth_config for Google Index Worker [@dpfaffenbauer](https://github.com/dachcom-digital/pimcore-seo/pull/69)
- **[BUGFIX]** Fix Migration and Installer

## 3.1.2
- **[BUGFIX]** Improve Migrations

Expand Down
2 changes: 1 addition & 1 deletion config/install/sql/install.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS `seo_element_meta_data` (
`data` longtext NOT NULL COMMENT '(DC2Type:array)',
`release_type` varchar(255) default 'public' not null,
PRIMARY KEY (`id`),
UNIQUE KEY `element_type_id_integrator` (`element_type`,`element_id`,`integrator`)
UNIQUE KEY `element_type_id_integrator` (`element_type`,`element_id`,`integrator`, `release_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;

CREATE TABLE IF NOT EXISTS `seo_queue_entry` (
Expand Down
30 changes: 30 additions & 0 deletions src/Migrations/Version20240827080929.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

namespace SeoBundle\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version20240827080929 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
if (!$schema->getTable('seo_element_meta_data')->hasIndex('element_type_id_integrator')) {
return;
}

$this->addSql('DROP INDEX element_type_id_integrator ON seo_element_meta_data;');
$this->addSql('CREATE UNIQUE INDEX element_type_id_integrator ON seo_element_meta_data (element_type, element_id, integrator, release_type);');
}

public function down(Schema $schema): void
{
}
}
6 changes: 6 additions & 0 deletions src/Tool/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Pimcore\Extension\Bundle\Installer\Exception\InstallationException;
use Pimcore\Extension\Bundle\Installer\SettingsStoreAwareInstaller;
use Pimcore\Model\User\Permission;
use SeoBundle\Migrations\Version20240827080929;
use Symfony\Component\Serializer\Encoder\DecoderInterface;

class Install extends SettingsStoreAwareInstaller
Expand Down Expand Up @@ -36,6 +37,11 @@ public function install(): void
parent::install();
}

public function getLastMigrationVersionClassName(): ?string
{
return Version20240827080929::class;
}

protected function installDbStructure(): void
{
$db = \Pimcore\Db::get();
Expand Down

0 comments on commit eda153f

Please sign in to comment.