Neos\Flow\Persistence\Doctrine\Migrations\Version20150913173832::up PHP Метод

up() публичный Метод

public up ( Doctrine\DBAL\Schema\Schema $schema ) : void
$schema Doctrine\DBAL\Schema\Schema
Результат void
    public function up(Schema $schema)
    {
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
        $this->addSql("ALTER TABLE typo3_media_domain_model_thumbnail ADD configuration LONGTEXT NOT NULL COMMENT '(DC2Type:json_array)', ADD configurationhash VARCHAR(32) NOT NULL");
        $thumbnailResult = $this->connection->executeQuery('SELECT * FROM typo3_media_domain_model_thumbnail');
        while ($thumbnailInfo = $thumbnailResult->fetch(\PDO::FETCH_ASSOC)) {
            $configurationArray = array_filter(['maximumWidth' => $thumbnailInfo['maximumwidth'], 'maximumHeight' => $thumbnailInfo['maximumheight'], 'ratioMode' => $thumbnailInfo['ratiomode'], 'allowUpScaling' => $thumbnailInfo['allowupscaling'] === 1 ? true : false], function ($value) {
                return $value !== null;
            });
            ksort($configurationArray);
            $configuration = json_encode($configurationArray, JSON_PRETTY_PRINT | JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE);
            $configurationHash = md5(json_encode($configurationArray));
            $this->addSql(sprintf("UPDATE typo3_media_domain_model_thumbnail SET configuration = '%s', configurationhash = '%s' WHERE persistence_object_identifier = '%s'", $configuration, $configurationHash, $thumbnailInfo['persistence_object_identifier']));
        }
        $this->addSql("ALTER TABLE typo3_media_domain_model_thumbnail DROP maximumwidth, DROP maximumheight, DROP ratiomode, DROP allowupscaling");
        $this->addSql("CREATE INDEX originalasset_configurationhash ON typo3_media_domain_model_thumbnail (originalasset, configurationhash)");
    }
Version20150913173832