diff --git a/packages/plugin/src/Tests/Attributes/Property/PropertyTypes/Table/TableTransformerTest.php b/packages/plugin/src/Tests/Attributes/Property/PropertyTypes/Table/TableTransformerTest.php index 189f0a5d0..cfebe8b3c 100644 --- a/packages/plugin/src/Tests/Attributes/Property/PropertyTypes/Table/TableTransformerTest.php +++ b/packages/plugin/src/Tests/Attributes/Property/PropertyTypes/Table/TableTransformerTest.php @@ -46,9 +46,9 @@ public function testReverseTransform() $output = (new TableTransformer())->reverseTransform($value); $expected = [ - ['label' => 'Col 1', 'value' => 'one', 'type' => 'string'], - ['label' => 'Col 2', 'value' => 'two', 'type' => 'checkbox'], - ['label' => 'Col 3', 'value' => 'three;four;five', 'type' => 'select'], + ['label' => 'Col 1', 'value' => 'one', 'type' => 'string', 'placeholder' => '', 'options' => [], 'checked' => false], + ['label' => 'Col 2', 'value' => 'two', 'type' => 'checkbox', 'placeholder' => '', 'options' => [], 'checked' => false], + ['label' => 'Col 3', 'value' => 'three;four;five', 'type' => 'select', 'placeholder' => '', 'options' => [], 'checked' => false], ]; $this->assertEquals($expected, $output); diff --git a/packages/plugin/src/migrations/m241104_091432_AddOptionsToIntegrationFields.php b/packages/plugin/src/migrations/m241104_091432_AddOptionsToIntegrationFields.php index da153127e..4cb4adf6e 100644 --- a/packages/plugin/src/migrations/m241104_091432_AddOptionsToIntegrationFields.php +++ b/packages/plugin/src/migrations/m241104_091432_AddOptionsToIntegrationFields.php @@ -8,6 +8,10 @@ class m241104_091432_AddOptionsToIntegrationFields extends Migration { public function safeUp(): bool { + if ($this->db->columnExists('{{%freeform_crm_fields}}', 'options')) { + return true; + } + $this->addColumn( '{{%freeform_crm_fields}}', 'options', @@ -25,6 +29,10 @@ public function safeUp(): bool public function safeDown(): bool { + if (!$this->db->columnExists('{{%freeform_crm_fields}}', 'options')) { + return true; + } + $this->dropColumn('{{%freeform_crm_fields}}', 'options'); $this->dropColumn('{{%freeform_email_marketing_fields}}', 'options'); diff --git a/packages/plugin/src/migrations/m241210_054218_AddOptionColumnFixForIntegrations.php b/packages/plugin/src/migrations/m241210_054218_AddOptionColumnFixForIntegrations.php new file mode 100644 index 000000000..6be507657 --- /dev/null +++ b/packages/plugin/src/migrations/m241210_054218_AddOptionColumnFixForIntegrations.php @@ -0,0 +1,41 @@ +db->columnExists('{{%freeform_crm_fields}}', 'options')) { + return true; + } + + $this->addColumn( + '{{%freeform_crm_fields}}', + 'options', + $this->json()->after('required') + ); + + $this->addColumn( + '{{%freeform_email_marketing_fields}}', + 'options', + $this->json()->after('required') + ); + + return true; + } + + public function safeDown(): bool + { + if (!$this->db->columnExists('{{%freeform_crm_fields}}', 'options')) { + return true; + } + + $this->dropColumn('{{%freeform_crm_fields}}', 'options'); + $this->dropColumn('{{%freeform_email_marketing_fields}}', 'options'); + + return true; + } +}