Skip to content

Commit 738fef3

Browse files
authored
fix migration and installer (#474)
1 parent 3b36754 commit 738fef3

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

UPGRADE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Upgrade Notes
22

3+
## 5.1.1
4+
- **[BUGFIX]** Fix Migration and Installer
5+
36
## 5.1.0
47
- **[SECURITY FEATURE]** Double-Opt-In Feature, read more about it [here](./docs/04_DoubleOptIn.md)
58
- **[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)

src/Migrations/Version20240819150642.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,16 @@ public function up(Schema $schema): void
2424
$installer = $this->container->get(Install::class);
2525
$installer->updateTranslations();
2626

27-
$this->addSql('ALTER TABLE formbuilder_forms DROP mailLayout;');
27+
if ($schema->getTable('formbuilder_forms')->hasColumn('mailLayout')) {
28+
$this->addSql('ALTER TABLE formbuilder_forms DROP mailLayout;');
29+
}
30+
31+
if ($schema->hasTable('formbuilder_double_opt_in_session')) {
32+
return;
33+
}
2834

2935
$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;');
3036
$this->addSql('ALTER TABLE formbuilder_double_opt_in_session ADD CONSTRAINT FK_88815C4F61F7634C FOREIGN KEY (form_definition) REFERENCES formbuilder_forms (id) ON DELETE CASCADE;');
31-
3237
}
3338

3439
public function down(Schema $schema): void

src/Tool/Install.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace FormBuilderBundle\Tool;
44

5+
use FormBuilderBundle\Migrations\Version20240819150642;
56
use Pimcore\Extension\Bundle\Installer\Exception\InstallationException;
67
use Pimcore\Extension\Bundle\Installer\SettingsStoreAwareInstaller;
78
use Pimcore\Model\Asset;
@@ -27,6 +28,11 @@ public function install(): void
2728
parent::install();
2829
}
2930

31+
public function getLastMigrationVersionClassName(): ?string
32+
{
33+
return Version20240819150642::class;
34+
}
35+
3036
public function updateTranslations(): void
3137
{
3238
$this->installTranslations();

0 commit comments

Comments
 (0)