clickandmortar / akeneo-migrations-manager-bundle
Akeneo 迁移管理包
1.1.2
2019-08-13 12:48 UTC
Requires
- akeneo/pim-community-dev: ^3.1.0
README
此包允许您在 Akeneo 项目仪表板上管理迁移。
此包提供了一个小部件来列出可用的迁移,并提供了自定义作业来跟踪迁移执行。
由 C&M 用💙制作
版本
要求
安装
下载包
$ composer require clickandmortar/akeneo-migrations-manager-bundle
启用包
通过将其添加到项目中 app/AppKernel.php
文件中注册的包列表中启用包
<?php // app/AppKernel.php // ... class AppKernel extends Kernel { public function registerProjectBundles() { return [ // ... new ClickAndMortar\AkeneoMigrationsManagerBundle\ClickAndMortarAkeneoMigrationsManagerBundle(), ]; // ... } // ... }
配置
创建自定义作业以管理迁移
php bin/console akeneo:batch:create-job internal execute_migration migration execute_migration_by_version '{"migrationVersion":null}' 'Execute migration by version'
用法
创建迁移
使用经典命令创建新的迁移
php bin/console doctrine:migrations:generate
扩展 AbstractStepMigration
以使用步骤方法。示例
<?php namespace Pim\Upgrade\Schema; use ClickAndMortar\AkeneoMigrationsManagerBundle\Migration\AbstractStepMigration; use Doctrine\DBAL\Schema\Schema; /** * Class Version20190121174114 * * @author Simon CARRE <simon.carre@clickandmortar.fr> * @package Pim\Upgrade\Schema */ class Version20190121174114 extends AbstractStepMigration { /** * Migration label * * @var string */ const MIGRATION_LABEL = 'Update to 1.0.1'; /** * @param Schema $schema */ public function up(Schema $schema) { $this->createNewStep('Start a new step'); // Process here $this->addWarning('Error: Bad process'); $this->createNewStep('Start the last step'); // Process here } /** * Get migration label used in dashboard widget * * @return string */ public static function getLabel() { return self::MIGRATION_LABEL; } }
开始迁移
您可以使用自定义创建的作业开始迁移,以便在控件视图中启用跟踪
php bin/console akeneo:batch:job -c '{"migrationVersion":"<my_version>"}' execute_migration_by_version