shyim/shopware-migration

此包已废弃,不再维护。未建议替代包。

提供易于使用的插件迁移功能

1.1.2 2017-12-14 15:34 UTC

This package is auto-updated.

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


README

如何使用此工具?

  • 在插件文件夹中需要迁移包
composer require shyim/shopware-migration
  • 在插件引导顶部包含autoload.php
require __DIR__ . '/vendor/autoload.php';

use ShyimMigration\AbstractMigration;
use ShyimMigration\MigrationManager;
  • 在Pluginname/Resources/migrations中创建一个新的迁移文件夹
  • 在我们的安装、更新、卸载方法中调用迁移
    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);
        }
    }

示例插件

ShyimMigrationTest