refactor(plugin): rename Plan to Program and add audience/UTM routes
Rename the Plan bundle to Program across config, routes, menus, and controllers (Plan -> Initiative), bump version to 0.16.0, and introduce new audience and UTM taxonomy routes and permissions to support the expanded Programs feature set.
This commit is contained in:
1 parent
8268fad886
commit
71ff11390b
121 files changed
+5011
-2874
No files matched your search
@@ -2,15 +2,15 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace MauticPlugin\PlanBundle\Migrations;
|
||||
namespace MauticPlugin\ProgramBundle\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Mautic\IntegrationsBundle\Migration\AbstractMigration;
|
||||
use MauticPlugin\PlanBundle\Entity\Plan;
|
||||
use MauticPlugin\PlanBundle\Entity\PlanObjective;
|
||||
use MauticPlugin\ProgramBundle\Entity\Initiative;
|
||||
use MauticPlugin\ProgramBundle\Entity\InitiativeObjective;
|
||||
|
||||
/**
|
||||
* Adds plans.version and the plan_objectives table to installs created before 0.3.0.
|
||||
* Adds plans.version and the initiative_objectives table to installs created before 0.3.0.
|
||||
*
|
||||
* Fresh installs get both from the entity mapping, so this migration then finds nothing to do.
|
||||
*/
|
||||
@@ -18,29 +18,26 @@ class Version_0_3_0 extends AbstractMigration
|
||||
{
|
||||
protected function isApplicable(Schema $schema): bool
|
||||
{
|
||||
$plans = $this->concatPrefix(Plan::TABLE_NAME);
|
||||
|
||||
if (!$schema->hasTable($plans)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !$schema->getTable($plans)->hasColumn('version')
|
||||
|| !$schema->hasTable($this->concatPrefix(PlanObjective::TABLE_NAME));
|
||||
// Historical migration: its changes were applied on every install that ran
|
||||
// it before 0.16.0 (this plugin renamed Plan→Program/Initiative in 0.16.0), and
|
||||
// a fresh install creates the current tables from the entity mapping. Never
|
||||
// applicable anymore.
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function up(): void
|
||||
{
|
||||
$schema = $this->entityManager->getConnection()->createSchemaManager()->introspectSchema();
|
||||
$plans = $this->concatPrefix(Plan::TABLE_NAME);
|
||||
$objectives = $this->concatPrefix(PlanObjective::TABLE_NAME);
|
||||
$plans = $this->concatPrefix(Initiative::TABLE_NAME);
|
||||
$objectives = $this->concatPrefix(InitiativeObjective::TABLE_NAME);
|
||||
|
||||
if (!$schema->getTable($plans)->hasColumn('version')) {
|
||||
$this->addSql("ALTER TABLE {$plans} ADD version SMALLINT UNSIGNED DEFAULT 1 NOT NULL");
|
||||
}
|
||||
|
||||
if (!$schema->hasTable($objectives)) {
|
||||
$index = $this->generatePropertyName(PlanObjective::TABLE_NAME, 'idx', ['plan_id']);
|
||||
$foreignKey = $this->generatePropertyName(PlanObjective::TABLE_NAME, 'fk', ['plan_id']);
|
||||
$index = $this->generatePropertyName(InitiativeObjective::TABLE_NAME, 'idx', ['plan_id']);
|
||||
$foreignKey = $this->generatePropertyName(InitiativeObjective::TABLE_NAME, 'fk', ['plan_id']);
|
||||
|
||||
$this->addSql("CREATE TABLE {$objectives} (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL,
|
||||
|
||||
Reference in new issue
Block a user