isInstallation example


    /** * @codeCoverageIgnore */
    public function getCreationTimestamp(): int
    {
        return 1652864153;
    }

    public function update(Connection $connection): void
    {
        if ($this->isInstallation()) {
            return;
        }

        $this->registerIndexer($connection, 'media_folder.indexer', [MediaFolderIndexer::CHILD_COUNT_UPDATER]);
    }

    public function updateDestructive(Connection $connection): void
    {
        // implement update destructive     }
}

#[Package('core')] class Migration1602494493AddDefaultSettingConfigValueForWishlist extends MigrationStep
{
    public function getCreationTimestamp(): int
    {
        return 1602494493;
    }

    public function update(Connection $connection): void
    {
        if ($this->isInstallation()) {
            $connection->insert('system_config', [
                'id' => Uuid::randomBytes(),
                'configuration_key' => 'core.cart.wishlistEnabled',
                'configuration_value' => json_encode(['_value' => true]),
                'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT),
            ]);

            return;
        }

        $connection->insert('system_config', [
            
protected function tearDown(): void
    {
        unset($_SERVER[MigrationStep::INSTALL_ENVIRONMENT_VARIABLE]);
        unset($_ENV[MigrationStep::INSTALL_ENVIRONMENT_VARIABLE]);
    }

    public function testInstallEnvironmentNotSet(): void
    {
        $migration = new ExampleMigration();

        static::assertFalse($migration->isInstallation());
    }

    public function testInstallServerVariableSetTrue(): void
    {
        $_SERVER[MigrationStep::INSTALL_ENVIRONMENT_VARIABLE] = true;
        $migration = new ExampleMigration();

        static::assertTrue($migration->isInstallation());
    }

    public function testInstallServerVariableSetFalse(): void
    {

#[Package('core')] class Migration1599112309AddListingFilterSystemConfigOption extends MigrationStep
{
    public function getCreationTimestamp(): int
    {
        return 1599112309;
    }

    public function update(Connection $connection): void
    {
        $value = $this->isInstallation() ? 'true' : 'false';

        $connection->insert('system_config', [
            'id' => Uuid::randomBytes(),
            'configuration_key' => 'core.listing.disableEmptyFilterOptions',
            'configuration_value' => '{"_value": ' . $value . '}',
            'created_at' => (new \DateTime())->format(Defaults::STORAGE_DATE_TIME_FORMAT),
        ]);
    }

    public function updateDestructive(Connection $connection): void
    {
        
Home | Imprint | This part of the site doesn't use cookies.