library shopware-migration
Provides easy to use plugin migrations
shyim/shopware-migration
Provides easy to use plugin migrations
- Thursday, December 14, 2017
- by shyim
- Repository
- 2 Watchers
- 3 Stars
- 64 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 4 Versions
- 392 % Grown
Easy to use Migrations for Shopware Plugins using Shopware Default Migrations
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, (*1)