Skip to content

Commit fee3064

Browse files
committed
Merge branch '5.0' into 5.0.1-to-5.x
2 parents b1f1e4a + c3be3bb commit fee3064

File tree

3 files changed

+74
-2
lines changed

3 files changed

+74
-2
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
}

app/release_metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"version": "5.0.0",
2+
"version": "5.0.1",
33
"stability": "stable",
44
"minimum_php_version": "8.0.2",
55
"maximum_php_version": "8.1.99",
66
"minimum_mysql_version": "5.7.14",
77
"minimum_mariadb_version": "10.2.7",
88
"show_php_version_warning_if_under": "8.0.2",
99
"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"
1111
}

0 commit comments

Comments
 (0)