shyim/shopware-migration

This package is abandoned and no longer maintained. No replacement package was suggested.

Provides easy to use plugin migrations

1.1.2 2017-12-14 15:34 UTC

This package is auto-updated.

Last update: 2022-11-07 02:17:56 UTC


README

How to use this?

  • Require migration package in our plugin folder
composer require shyim/shopware-migration
  • Include autoload.php on top our Plugin Bootstrap
require __DIR__ . '/vendor/autoload.php';

use ShyimMigration\AbstractMigration;
use ShyimMigration\MigrationManager;
  • Create a new migration folder in Pluginname/Resources/migrations
  • Call migrations in our install, update, uninstall method
    public function install(InstallContext $context)
    {
        MigrationManager::doMigrations($this, $this->container, AbstractMigration::MODUS_INSTALL);
    }

    public function update(Plugin\Context\UpdateContext $context)
    {
        MigrationManager::doMigrations($this, $this->container, AbstractMigration::MODUS_UPDATE);
    }

    public function uninstall(UninstallContext $context)
    {
        if (!$context->keepUserData()) {
            MigrationManager::doMigrations($this, $this->container, AbstractMigration::MODUS_UNINSTALL);
        }
    }

Example Plugin

ShyimMigrationTest