tao-test/app/qtiItemPci/migrations/Version202010041158341465_qtiItemPci.php

48 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace oat\qtiItemPci\migrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\Exception\IrreversibleMigration;
use oat\qtiItemPci\model\IMSPciModel;
use oat\qtiItemPci\scripts\install\RegisterPciLiquid;
use oat\tao\scripts\tools\migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version202010041158341465_qtiItemPci extends AbstractMigration
{
public function getDescription(): string
{
return 'Update Liquids interaction';
}
public function up(Schema $schema): void
{
$registry = (new IMSPciModel())->getRegistry();
if ($registry->has('liquidsInteraction')) {
/** @noinspection PhpUnhandledExceptionInspection */
$registry->removeAllVersions('liquidsInteraction');
}
$this->addReport(
$this->propagate(
new RegisterPciLiquid()
)(
['0.4.2']
)
);
}
public function down(Schema $schema): void
{
throw new IrreversibleMigration(
'In order to undo this migration, please revert the client-side changes and run ' . RegisterPciLiquid::class
);
}
}