diff --git a/src/CRM/CivixBundle/Command/AddUpgraderCommand.php b/src/CRM/CivixBundle/Command/AddUpgraderCommand.php index 1f428327..ee5df577 100644 --- a/src/CRM/CivixBundle/Command/AddUpgraderCommand.php +++ b/src/CRM/CivixBundle/Command/AddUpgraderCommand.php @@ -4,6 +4,7 @@ use CRM\CivixBundle\Application; use Civix; use CRM\CivixBundle\Utils\Files; +use CRM\CivixBundle\Utils\Naming; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use CRM\CivixBundle\Builder\Dirs; @@ -55,9 +56,8 @@ protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln(sprintf('Skip %s: file already exists, defer to customized version', Files::relativize($phpFile))); } - if (!$info->get()->xpath('upgrader')) { - $info->get()->addChild('upgrader', $crmPrefix . '_Upgrader'); - } + // AutomaticUpgrader delegates to CRM_*_Upgrader and also supports automatic SQL generation. + $info->get()->upgrader = sprintf('CiviMix\\Schema\\%s\\AutomaticUpgrader', Naming::createCamelName($info->getFile())); $info->raiseCompatibilityMinimum('5.38'); $info->save($ctx, $output);