Files
mautic-marketing-program-bu…/Migrations/Version_0_9_0.php
T
Alexandre Gain 8696acd01c feat: Add TargetType form and migration for plan targets
- Implemented TargetType form for managing target details including name, type, priority, stages, estimated size, profile criteria, pain points, value proposition, and preferred channels.
- Created migration scripts for adding type and priority columns to plan objectives and tasks.
- Added migration for creating plan targets and plan target stages tables, including foreign key constraints.
- Introduced stakeholder management with forms and views for creating, editing, and listing stakeholders.
- Enhanced UI with read more functionality for long text descriptions and filtering options in plan tab tables.
2026-11-08 11:54:25 +01:00

40 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace MauticPlugin\PlanBundle\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Mautic\IntegrationsBundle\Migration\AbstractMigration;
use MauticPlugin\PlanBundle\Entity\Task;
/**
* Since 0.9.0 tasks have a type, the key of a task type set up in Settings > Configuration > Plan
* Settings (parameter plan_task_types). Adds plan_tasks.type for installs created before 0.9.0. The
* column is nullable: existing tasks have no type yet, and each one must be given one before it can be
* saved again (validation requires it). Runs only when the column is missing.
*/
class Version_0_9_0 extends AbstractMigration
{
protected function isApplicable(Schema $schema): bool
{
$tasks = $this->concatPrefix(Task::TABLE_NAME);
if (!$schema->hasTable($tasks)) {
return false;
}
return !$schema->getTable($tasks)->hasColumn('type');
}
protected function up(): void
{
$tasks = $this->concatPrefix(Task::TABLE_NAME);
$table = $this->entityManager->getConnection()->createSchemaManager()->introspectTable($tasks);
if (!$table->hasColumn('type')) {
$this->addSql(sprintf('ALTER TABLE %s ADD type VARCHAR(%d) DEFAULT NULL', $tasks, Task::TYPE_MAX_LENGTH));
}
}
}