File tree Expand file tree Collapse file tree 3 files changed +74
-2
lines changed Expand file tree Collapse file tree 3 files changed +74
-2
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace Mautic \Migrations ;
6
+
7
+ use Doctrine \DBAL \Schema \Schema ;
8
+ use Doctrine \Migrations \Exception \SkipMigration ;
9
+ use Mautic \CoreBundle \Doctrine \AbstractMauticMigration ;
10
+
11
+ final class Version20200415135706 extends AbstractMauticMigration
12
+ {
13
+ public function preUp (Schema $ schema ): void
14
+ {
15
+ if ($ schema ->getTable ("{$ this ->prefix }form_fields " )->hasColumn ('mapped_object ' )) {
16
+ throw new SkipMigration ('Schema includes this migration ' );
17
+ }
18
+ }
19
+
20
+ public function up (Schema $ schema ): void
21
+ {
22
+ $ this ->addSql ("ALTER TABLE {$ this ->prefix }form_fields
23
+ ADD mapped_object VARCHAR(191) DEFAULT NULL,
24
+ ADD mapped_field VARCHAR(191) DEFAULT NULL " );
25
+
26
+ // All field that starts with company belongs to the company object.
27
+ // Except the company field itself that belongs to the contact (lead) object.
28
+ $ this ->addSql ("UPDATE {$ this ->prefix }form_fields
29
+ SET mapped_object = CASE
30
+ WHEN lead_field LIKE 'company%' AND lead_field != 'company' THEN 'company'
31
+ ELSE 'contact'
32
+ END, mapped_field = lead_field
33
+ WHERE lead_field IS NOT NULL " );
34
+ }
35
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace Mautic \Migrations ;
6
+
7
+ use Doctrine \DBAL \Schema \Schema ;
8
+ use Doctrine \DBAL \Schema \SchemaException ;
9
+ use Doctrine \Migrations \Exception \SkipMigration ;
10
+ use Mautic \CoreBundle \Doctrine \AbstractMauticMigration ;
11
+
12
+ /**
13
+ * Migration for removing online status.
14
+ */
15
+ class Version20200513162918 extends AbstractMauticMigration
16
+ {
17
+ /**
18
+ * @throws SkipMigration
19
+ * @throws SchemaException
20
+ */
21
+ public function preUp (Schema $ schema ): void
22
+ {
23
+ if ($ schema ->getTable ("{$ this ->prefix }email_copies " )->hasColumn ('body_text ' )) {
24
+ throw new SkipMigration ("The body_text column has already been added to the {$ this ->prefix }email_copies table. " );
25
+ }
26
+ }
27
+
28
+ public function up (Schema $ schema ): void
29
+ {
30
+ $ this ->addSql ("ALTER TABLE {$ this ->prefix }email_copies ADD COLUMN `body_text` LONGTEXT NULL DEFAULT NULL AFTER `body` " );
31
+ }
32
+
33
+ public function down (Schema $ schema ): void
34
+ {
35
+ $ this ->addSql ("ALTER TABLE {$ this ->prefix }email_copies DROP COLUMN `body_text` " );
36
+ }
37
+ }
Original file line number Diff line number Diff line change 1
1
{
2
- "version" : " 5.0.0 " ,
2
+ "version" : " 5.0.1 " ,
3
3
"stability" : " stable" ,
4
4
"minimum_php_version" : " 8.0.2" ,
5
5
"maximum_php_version" : " 8.1.99" ,
6
6
"minimum_mysql_version" : " 5.7.14" ,
7
7
"minimum_mariadb_version" : " 10.2.7" ,
8
8
"show_php_version_warning_if_under" : " 8.0.2" ,
9
9
"minimum_mautic_version" : " 4.4.10" ,
10
- "announcement_url" : " https://github.com/mautic/mautic/releases/tag/5.0.0 "
10
+ "announcement_url" : " https://github.com/mautic/mautic/releases/tag/5.0.1 "
11
11
}
You can’t perform that action at this time.
0 commit comments