Two domains, one MT3S bundle: Marketing Programs (unchanged) and the
imported Smart Links (smart links + UTM taxonomies), each keeping its
own menu, tables, routes and translations.
- Code moved from MauticPlugin\SmartlinksBundle\ to
MauticPlugin\MT3SMarketingProgramBundle\; template namespace
@Smartlinks/ -> @MT3SMarketingProgram/; smartlinks.js ->
Assets/js/mt3s-mp-smartlinks.js; icon -> Assets/img/smartlinks-icon.svg.
- Incoming migrations renamed Version_0_X_0_SmartLinks.php to avoid
the class-name collision; schema untouched, data intact.
- Permissions folded into MT3SMarketingProgramPermissions:
smart_links + taxonomies under the mt3smarketingprogram: base
(roles that had the old smartlinks: grants must be re-granted).
- config.php: Smart Links routes + menu group, public /l/{slug},
SmartlinksIntegration services, smartlinks_* parameters (legacy
utm_manager_* keys still readable), version 0.18.0. The 0.17.0
placeholder /s/marketing-program-utm-taxonomies is replaced by the
real /s/utm-taxonomies.
- Translations merged (en_US) and added (fr_FR); Tests/ + phpunit moved
in; readme documents both domains and the 0.18.0 merge history.
Verified live: menus, both config tabs, both lists + forms, program
pages, public redirect with taxonomy UTM values, host + unknown-slug
404s, 90/90 unit tests, full php -l, all ini catalogs parse.
55 lines
2.1 KiB
PHP
55 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Mautic\IntegrationsBundle\Migration\AbstractMigration;
|
|
use MauticPlugin\MT3SMarketingProgramBundle\Entity\SmartLink;
|
|
|
|
/**
|
|
* Creates the Smart Links table for installs of version 0.1.0, which predate the feature.
|
|
*
|
|
* The plugin installer creates the tables of fresh installs (installPluginSchema runs
|
|
* SchemaTool on the plugin's own entities); on update core only runs these migrations.
|
|
* Idempotent: runs on plugin update (core's migration engine) and right after a fresh
|
|
* install (PluginInstallSubscriber), and stops when the table already exists.
|
|
*/
|
|
class Version_0_2_0_SmartLinks extends AbstractMigration
|
|
{
|
|
protected function isApplicable(Schema $schema): bool
|
|
{
|
|
return !$schema->hasTable($this->concatPrefix(SmartLink::TABLE_NAME));
|
|
}
|
|
|
|
protected function up(): void
|
|
{
|
|
$table = $this->concatPrefix(SmartLink::TABLE_NAME);
|
|
|
|
$this->addSql(<<<SQL
|
|
CREATE TABLE {$table} (
|
|
id INT UNSIGNED AUTO_INCREMENT NOT NULL,
|
|
is_published TINYINT(1) NOT NULL,
|
|
date_added DATETIME DEFAULT NULL,
|
|
created_by INT DEFAULT NULL,
|
|
created_by_user VARCHAR(191) DEFAULT NULL,
|
|
date_modified DATETIME DEFAULT NULL,
|
|
modified_by INT DEFAULT NULL,
|
|
modified_by_user VARCHAR(191) DEFAULT NULL,
|
|
checked_out DATETIME DEFAULT NULL,
|
|
checked_out_by INT DEFAULT NULL,
|
|
checked_out_by_user VARCHAR(191) DEFAULT NULL,
|
|
slug VARCHAR(9) NOT NULL,
|
|
redirect_type VARCHAR(20) DEFAULT 'external' NOT NULL,
|
|
redirect_code INT DEFAULT 302 NOT NULL,
|
|
destination_url LONGTEXT DEFAULT NULL,
|
|
utm_parameters JSON NOT NULL,
|
|
UNIQUE INDEX UNIQ_SLUG (slug),
|
|
INDEX smart_link_slug (slug),
|
|
PRIMARY KEY(id)
|
|
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
|
|
SQL);
|
|
}
|
|
}
|