Skip to content

Commit

Permalink
Merge branch '5.0' into 5.0.1-to-5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
escopecz committed Jan 10, 2024
2 parents b1f1e4a + c3be3bb commit fee3064
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 2 deletions.
35 changes: 35 additions & 0 deletions app/migrations/Version20200415135706.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

namespace Mautic\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\Exception\SkipMigration;
use Mautic\CoreBundle\Doctrine\AbstractMauticMigration;

final class Version20200415135706 extends AbstractMauticMigration
{
public function preUp(Schema $schema): void
{
if ($schema->getTable("{$this->prefix}form_fields")->hasColumn('mapped_object')) {
throw new SkipMigration('Schema includes this migration');
}
}

public function up(Schema $schema): void
{
$this->addSql("ALTER TABLE {$this->prefix}form_fields
ADD mapped_object VARCHAR(191) DEFAULT NULL,
ADD mapped_field VARCHAR(191) DEFAULT NULL");

// All field that starts with company belongs to the company object.
// Except the company field itself that belongs to the contact (lead) object.
$this->addSql("UPDATE {$this->prefix}form_fields
SET mapped_object = CASE
WHEN lead_field LIKE 'company%' AND lead_field != 'company' THEN 'company'
ELSE 'contact'
END, mapped_field = lead_field
WHERE lead_field IS NOT NULL");
}
}
37 changes: 37 additions & 0 deletions app/migrations/Version20200513162918.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace Mautic\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\Migrations\Exception\SkipMigration;
use Mautic\CoreBundle\Doctrine\AbstractMauticMigration;

/**
* Migration for removing online status.
*/
class Version20200513162918 extends AbstractMauticMigration
{
/**
* @throws SkipMigration
* @throws SchemaException
*/
public function preUp(Schema $schema): void
{
if ($schema->getTable("{$this->prefix}email_copies")->hasColumn('body_text')) {
throw new SkipMigration("The body_text column has already been added to the {$this->prefix}email_copies table.");
}
}

public function up(Schema $schema): void
{
$this->addSql("ALTER TABLE {$this->prefix}email_copies ADD COLUMN `body_text` LONGTEXT NULL DEFAULT NULL AFTER `body`");
}

public function down(Schema $schema): void
{
$this->addSql("ALTER TABLE {$this->prefix}email_copies DROP COLUMN `body_text`");
}
}
4 changes: 2 additions & 2 deletions app/release_metadata.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"version": "5.0.0",
"version": "5.0.1",
"stability": "stable",
"minimum_php_version": "8.0.2",
"maximum_php_version": "8.1.99",
"minimum_mysql_version": "5.7.14",
"minimum_mariadb_version": "10.2.7",
"show_php_version_warning_if_under": "8.0.2",
"minimum_mautic_version": "4.4.10",
"announcement_url": "https://github.com/mautic/mautic/releases/tag/5.0.0"
"announcement_url": "https://github.com/mautic/mautic/releases/tag/5.0.1"
}

0 comments on commit fee3064

Please sign in to comment.