Skip to content

Commit

Permalink
fix migration and installer (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
solverat authored Aug 27, 2024
1 parent 3b36754 commit 738fef3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Upgrade Notes

## 5.1.1
- **[BUGFIX]** Fix Migration and Installer

## 5.1.0
- **[SECURITY FEATURE]** Double-Opt-In Feature, read more about it [here](./docs/04_DoubleOptIn.md)
- **[SECURITY FEATURE]** Email Checker Validator [#471](https://github.com/dachcom-digital/pimcore-formbuilder/issues/471), read more about it [here](./docs/03_SpamProtection.md#email-checker)
Expand Down
9 changes: 7 additions & 2 deletions src/Migrations/Version20240819150642.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,16 @@ public function up(Schema $schema): void
$installer = $this->container->get(Install::class);
$installer->updateTranslations();

$this->addSql('ALTER TABLE formbuilder_forms DROP mailLayout;');
if ($schema->getTable('formbuilder_forms')->hasColumn('mailLayout')) {
$this->addSql('ALTER TABLE formbuilder_forms DROP mailLayout;');
}

if ($schema->hasTable('formbuilder_double_opt_in_session')) {
return;
}

$this->addSql('CREATE TABLE formbuilder_double_opt_in_session (token BINARY(16) NOT NULL COMMENT "(DC2Type:uuid)", form_definition INT DEFAULT NULL, email VARCHAR(190) NOT NULL, additional_data LONGTEXT DEFAULT NULL COMMENT "(DC2Type:array)", dispatch_location LONGTEXT DEFAULT NULL, applied TINYINT(1) DEFAULT 0 NOT NULL, creationDate DATETIME NOT NULL, INDEX IDX_88815C4F61F7634C (form_definition), INDEX token_form (token, form_definition, applied), UNIQUE INDEX email_form_definition (email, form_definition, applied), PRIMARY KEY(token)) DEFAULT CHARACTER SET UTF8MB4 COLLATE `utf8mb4_general_ci` ENGINE = InnoDB;');
$this->addSql('ALTER TABLE formbuilder_double_opt_in_session ADD CONSTRAINT FK_88815C4F61F7634C FOREIGN KEY (form_definition) REFERENCES formbuilder_forms (id) ON DELETE CASCADE;');

}

public function down(Schema $schema): void
Expand Down
6 changes: 6 additions & 0 deletions src/Tool/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace FormBuilderBundle\Tool;

use FormBuilderBundle\Migrations\Version20240819150642;
use Pimcore\Extension\Bundle\Installer\Exception\InstallationException;
use Pimcore\Extension\Bundle\Installer\SettingsStoreAwareInstaller;
use Pimcore\Model\Asset;
Expand All @@ -27,6 +28,11 @@ public function install(): void
parent::install();
}

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

public function updateTranslations(): void
{
$this->installTranslations();
Expand Down

0 comments on commit 738fef3

Please sign in to comment.