Migration1688556247FixCoverMediaVersionID example

->cover('cover')
            ->price(100)
            ->build();

        $connection = $this->getContainer()->get(Connection::class);
        $connection->executeStatement('DELETE FROM product');

        $this->getContainer()->get('product.repository')->create([$product], Context::createDefaultContext());

        $connection->executeStatement('UPDATE product SET product_media_version_id = NULL');

        $migration = new Migration1688556247FixCoverMediaVersionID();
        $migration->update($connection);

        $result = $connection->fetchOne('SELECT COUNT(1) FROM product WHERE product_media_version_id IS NULL');
        static::assertSame('0', $result);

        $data = $connection->fetchAssociative('SELECT * FROM product');

        $migration->update($connection);

        $newData = $connection->fetchAssociative('SELECT * FROM product');
        static::assertEquals($data$newData, 'Data should not change after second migration run');
    }
Home | Imprint | This part of the site doesn't use cookies.