clickandmortar / akeneo-migrations-manager-bundle
Akeneo Migrations manager bundle
Installs: 128
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- akeneo/pim-community-dev: ^3.1.0
README
This bundle allows to manage migrations on dashboard on your Akeneo project.
This bundle provides a widget to list available migrations and a custom job to follow migrations execution.
Made with 💙 by C&M
Versions
Requirements
Installation
Download the Bundle
$ composer require clickandmortar/akeneo-migrations-manager-bundle
Enable the Bundle
Enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php
file of your project:
<?php // app/AppKernel.php // ... class AppKernel extends Kernel { public function registerProjectBundles() { return [ // ... new ClickAndMortar\AkeneoMigrationsManagerBundle\ClickAndMortarAkeneoMigrationsManagerBundle(), ]; // ... } // ... }
Configuration
Create custom job to manage migrations
php bin/console akeneo:batch:create-job internal execute_migration migration execute_migration_by_version '{"migrationVersion":null}' 'Execute migration by version'
Usage
Create migration
Create a new migration with the classic command:
php bin/console doctrine:migrations:generate
Extends AbstractStepMigration
to use steps methods. Example:
<?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; } }
Start migration
You can start migration with custom created job to enable tracking in widget view:
php bin/console akeneo:batch:job -c '{"migrationVersion":"<my_version>"}' execute_migration_by_version