migrateDestructiveInPlace example

static::assertNull($migrations[1]['update_destructive']);
    }

    public function testNoDestructiveIfNoNoneDestructive(): void
    {
        $migrations = $this->getMigrations();
        static::assertNull($migrations[0]['update']);
        static::assertNull($migrations[0]['update_destructive']);
        static::assertNull($migrations[1]['update']);
        static::assertNull($migrations[1]['update_destructive']);

        $this->validMigrationCollection->migrateDestructiveInPlace();

        $migrations = $this->getMigrations();
        static::assertNull($migrations[0]['update']);
        static::assertNull($migrations[0]['update_destructive']);
        static::assertNull($migrations[1]['update']);
        static::assertNull($migrations[1]['update_destructive']);
    }

    public function testDestructiveIfOneNoneDestructive(): void
    {
        $migrations = $this->getMigrations();
        
$this->expectException(InvalidMigrationClassException::class);
        $collection->getMigrationSteps();
    }

    public function testNullcollection(): void
    {
        $nullCollection = $this->loader->collect('null');

        $nullCollection->sync();

        static::assertCount(0, $nullCollection->migrateInPlace());
        static::assertCount(0, $nullCollection->migrateDestructiveInPlace());

        static::assertCount(0, $nullCollection->getMigrationSteps());
        static::assertCount(0, $nullCollection->getActiveMigrationTimestamps());
        static::assertCount(0, $nullCollection->getExecutableMigrations());
        static::assertCount(0, $nullCollection->getExecutableDestructiveMigrations());
    }

    private function getMigrations(): array
    {
        return $this->connection->createQueryBuilder()
            ->select('*')
            
class SwagManualMigrationTest extends Plugin
{
    public function install(InstallContext $installContext): void
    {
        $installContext->setAutoMigrate(false);
        $installContext->getMigrationCollection()->migrateInPlace(1);
    }

    public function update(UpdateContext $updateContext): void
    {
        $updateContext->setAutoMigrate(false);
        $updateContext->getMigrationCollection()->migrateDestructiveInPlace(1);
        $updateContext->getMigrationCollection()->migrateInPlace(3);
    }

    public function activate(ActivateContext $activateContext): void
    {
        $activateContext->setAutoMigrate(false);
        $activateContext->getMigrationCollection()->migrateInPlace(2);
    }

    public function deactivate(DeactivateContext $deactivateContext): void
    {
        
Home | Imprint | This part of the site doesn't use cookies.