-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: table tests and backup migration for integration options
- Loading branch information
1 parent
de132ae
commit bdf529a
Showing
3 changed files
with
52 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/plugin/src/migrations/m241210_054218_AddOptionColumnFixForIntegrations.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace Solspace\Freeform\migrations; | ||
|
||
use craft\db\Migration; | ||
|
||
class m241210_054218_AddOptionColumnFixForIntegrations extends Migration | ||
{ | ||
public function safeUp(): bool | ||
{ | ||
if ($this->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; | ||
} | ||
} |