Skip to content

Commit

Permalink
Cleanup platform getName() in migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsunet committed Jul 9, 2024
1 parent aac6927 commit 8cb5fb3
Show file tree
Hide file tree
Showing 125 changed files with 643 additions and 513 deletions.
11 changes: 6 additions & 5 deletions Neos.Media/Migrations/Mysql/Version20110925123120.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
namespace Neos\Flow\Persistence\Doctrine\Migrations;

use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Create needed tables for Media package
Expand All @@ -13,9 +14,9 @@ class Version20110925123120 extends AbstractMigration
* @param Schema $schema
* @return void
*/
public function up(Schema $schema): void
public function up(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->abortIf(!($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform));

$this->addSql("CREATE TABLE typo3_media_domain_model_image (flow3_persistence_identifier VARCHAR(40) NOT NULL, resource VARCHAR(40) DEFAULT NULL, title VARCHAR(255) DEFAULT NULL, width INT DEFAULT NULL, height INT DEFAULT NULL, type INT DEFAULT NULL, imagevariants LONGTEXT DEFAULT NULL COMMENT '(DC2Type:array)', INDEX IDX_7FA2358DBC91F416 (resource), PRIMARY KEY(flow3_persistence_identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB");

Expand All @@ -31,9 +32,9 @@ public function up(Schema $schema): void
* @param Schema $schema
* @return void
*/
public function down(Schema $schema): void
public function down(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->abortIf(!($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform));

$this->addSql("DROP TABLE typo3_media_domain_model_image");
}
Expand Down
11 changes: 6 additions & 5 deletions Neos.Media/Migrations/Mysql/Version20120329220344.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
namespace Neos\Flow\Persistence\Doctrine\Migrations;

use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Adjust default values to NOT NULL unless allowed in model.
Expand All @@ -13,9 +14,9 @@ class Version20120329220344 extends AbstractMigration
* @param Schema $schema
* @return void
*/
public function up(Schema $schema): void
public function up(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->abortIf(!($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform));

$this->addSql("ALTER TABLE typo3_media_domain_model_image CHANGE title title VARCHAR(255) NOT NULL, CHANGE width width INT NOT NULL, CHANGE height height INT NOT NULL, CHANGE type type INT NOT NULL, CHANGE imagevariants imagevariants LONGTEXT NOT NULL COMMENT '(DC2Type:array)'");
}
Expand All @@ -24,9 +25,9 @@ public function up(Schema $schema): void
* @param Schema $schema
* @return void
*/
public function down(Schema $schema): void
public function down(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->abortIf(!($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform));

$this->addSql("ALTER TABLE typo3_media_domain_model_image CHANGE title title VARCHAR(255) DEFAULT NULL, CHANGE width width INT DEFAULT NULL, CHANGE height height INT DEFAULT NULL, CHANGE type type INT DEFAULT NULL, CHANGE imagevariants imagevariants LONGTEXT DEFAULT NULL COMMENT '(DC2Type:array)'");
}
Expand Down
11 changes: 6 additions & 5 deletions Neos.Media/Migrations/Mysql/Version20121001181137.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
namespace Neos\Flow\Persistence\Doctrine\Migrations;

use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use Neos\Flow\Persistence\Doctrine\Service;

/**
Expand All @@ -14,9 +15,9 @@ class Version20121001181137 extends AbstractMigration
* @param Schema $schema
* @return void
*/
public function up(Schema $schema): void
public function up(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->abortIf(!($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform));

// collect foreign keys pointing to "our" tables
$foreignKeyHandlingSql = Service::getForeignKeyHandlingSql($schema, $this->platform, array('typo3_media_domain_model_image'), 'flow3_persistence_identifier', 'persistence_object_identifier');
Expand All @@ -41,9 +42,9 @@ public function up(Schema $schema): void
* @param Schema $schema
* @return void
*/
public function down(Schema $schema): void
public function down(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->abortIf(!($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform));

// collect foreign keys pointing to "our" tables
$foreignKeyHandlingSql = Service::getForeignKeyHandlingSql($schema, $this->platform, array('typo3_media_domain_model_image'), 'persistence_object_identifier', 'flow3_persistence_identifier');
Expand Down
11 changes: 6 additions & 5 deletions Neos.Media/Migrations/Mysql/Version20121011140946.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
namespace Neos\Flow\Persistence\Doctrine\Migrations;

use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Migration that renames occurrences of "FLOW3" legacies inside the imageVariants property
Expand All @@ -14,9 +15,9 @@ class Version20121011140946 extends AbstractMigration
* @param Schema $schema
* @return void
*/
public function up(Schema $schema): void
public function up(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->abortIf(!($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform));

$this->addSql("UPDATE typo3_media_domain_model_image SET imagevariants = REPLACE(imagevariants, 's:31:\"\0*\0FLOW3_Persistence_Identifier\";', 's:32:\"\0*\0Persistence_Object_Identifier\";') WHERE imagevariants LIKE '%s:31:\"\0*\0FLOW3_Persistence_Identifier\";%'");
$this->addSql("UPDATE typo3_media_domain_model_image SET imagevariants = REPLACE(imagevariants, 's:33:\"FLOW3_Persistence_RelatedEntities\";', 's:32:\"Flow_Persistence_RelatedEntities\";') WHERE imagevariants LIKE '%s:33:\"FLOW3_Persistence_RelatedEntities\";%'");
Expand All @@ -27,9 +28,9 @@ public function up(Schema $schema): void
* @param Schema $schema
* @return void
*/
public function down(Schema $schema): void
public function down(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->abortIf(!($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform));

$this->addSql("UPDATE typo3_media_domain_model_image SET imagevariants = REPLACE(imagevariants, 's:28:\"TYPO3\\\\Flow\\\\Resource\\\\Resource\";', 's:29:\"TYPO3\\\\FLOW3\\\\Resource\\\\Resource\";') WHERE imagevariants LIKE '%s:28:\"TYPO3\\\\\\\\Flow\\\\\\\\Resource\\\\\\\\Resource\";%'");
$this->addSql("UPDATE typo3_media_domain_model_image SET imagevariants = REPLACE(imagevariants, 's:32:\"Flow_Persistence_RelatedEntities\";', 's:33:\"FLOW3_Persistence_RelatedEntities\";') WHERE imagevariants LIKE '%s:32:\"Flow_Persistence_RelatedEntities\";%'");
Expand Down
11 changes: 6 additions & 5 deletions Neos.Media/Migrations/Mysql/Version20130522131641.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
namespace Neos\Flow\Persistence\Doctrine\Migrations;

use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Adjust Neos.Media tables to new Asset base class and add new models.
Expand All @@ -13,9 +14,9 @@ class Version20130522131641 extends AbstractMigration
* @param Schema $schema
* @return void
*/
public function up(Schema $schema): void
public function up(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->abortIf(!($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform));

// new tables for Asset, Document, Video, Audio
$this->addSql("CREATE TABLE typo3_media_domain_model_asset (persistence_object_identifier VARCHAR(40) NOT NULL, dtype VARCHAR(255) NOT NULL, resource VARCHAR(40) DEFAULT NULL, title VARCHAR(255) NOT NULL, INDEX IDX_B8306B8EBC91F416 (resource), PRIMARY KEY(persistence_object_identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB");
Expand All @@ -42,9 +43,9 @@ public function up(Schema $schema): void
* @param Schema $schema
* @return void
*/
public function down(Schema $schema): void
public function down(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->abortIf(!($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform));

// adjust Image table
$this->addSql("ALTER TABLE typo3_media_domain_model_image DROP FOREIGN KEY FK_7FA2358D47A46B0A");
Expand Down
11 changes: 6 additions & 5 deletions Neos.Media/Migrations/Mysql/Version20130522132835.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
namespace Neos\Flow\Persistence\Doctrine\Migrations;

use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Add tags to assets
Expand All @@ -13,9 +14,9 @@ class Version20130522132835 extends AbstractMigration
* @param Schema $schema
* @return void
*/
public function up(Schema $schema): void
public function up(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->abortIf(!($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform));

$this->addSql("CREATE TABLE typo3_media_domain_model_asset_tags_join (media_asset VARCHAR(40) NOT NULL, media_tag VARCHAR(40) NOT NULL, INDEX IDX_DAF7A1EB1DB69EED (media_asset), INDEX IDX_DAF7A1EB48D8C57E (media_tag), PRIMARY KEY(media_asset, media_tag)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB");
$this->addSql("CREATE TABLE typo3_media_domain_model_tag (persistence_object_identifier VARCHAR(40) NOT NULL, `label` VARCHAR(255) NOT NULL, PRIMARY KEY(persistence_object_identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB");
Expand All @@ -27,9 +28,9 @@ public function up(Schema $schema): void
* @param Schema $schema
* @return void
*/
public function down(Schema $schema): void
public function down(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->abortIf(!($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform));

$this->addSql("ALTER TABLE typo3_media_domain_model_asset_tags_join DROP FOREIGN KEY FK_DAF7A1EB48D8C57E");
$this->addSql("DROP TABLE typo3_media_domain_model_asset_tags_join");
Expand Down
11 changes: 6 additions & 5 deletions Neos.Media/Migrations/Mysql/Version20130605174712.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
namespace Neos\Flow\Persistence\Doctrine\Migrations;

use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Add caption and lastModified to Asset
Expand All @@ -13,9 +14,9 @@ class Version20130605174712 extends AbstractMigration
* @param Schema $schema
* @return void
*/
public function up(Schema $schema): void
public function up(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->abortIf(!($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform));

$this->addSql("ALTER TABLE typo3_media_domain_model_asset ADD caption LONGTEXT NOT NULL");
$this->addSql("ALTER TABLE typo3_media_domain_model_asset ADD lastmodified DATETIME NOT NULL");
Expand All @@ -25,9 +26,9 @@ public function up(Schema $schema): void
* @param Schema $schema
* @return void
*/
public function down(Schema $schema): void
public function down(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->abortIf(!($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform));

$this->addSql("ALTER TABLE typo3_media_domain_model_asset DROP lastmodified");
$this->addSql("ALTER TABLE typo3_media_domain_model_asset DROP caption");
Expand Down
11 changes: 6 additions & 5 deletions Neos.Media/Migrations/Mysql/Version20141118172322.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
namespace Neos\Flow\Persistence\Doctrine\Migrations;

use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Adjustments for the rewritten Flow resource management and the new domain model structure
Expand All @@ -13,9 +14,9 @@ class Version20141118172322 extends AbstractMigration
* @param Schema $schema
* @return void
*/
public function up(Schema $schema): void
public function up(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->abortIf(!($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform));

$this->addSql("CREATE TABLE typo3_media_domain_model_adjustment_abstractimageadjustment (persistence_object_identifier VARCHAR(40) NOT NULL, imagevariant VARCHAR(40) DEFAULT NULL, dtype VARCHAR(255) NOT NULL, x INT DEFAULT NULL, y INT DEFAULT NULL, width INT DEFAULT NULL, height INT DEFAULT NULL, maximumwidth INT DEFAULT NULL, maximumheight INT DEFAULT NULL, minimumwidth INT DEFAULT NULL, minimumheight INT DEFAULT NULL, ratiomode VARCHAR(255) DEFAULT NULL, INDEX IDX_84416FDCA76D06E6 (imagevariant), PRIMARY KEY(persistence_object_identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB");
$this->addSql("CREATE TABLE typo3_media_domain_model_imagevariant (persistence_object_identifier VARCHAR(40) NOT NULL, originalasset VARCHAR(40) NOT NULL, name VARCHAR(255) NOT NULL, width INT NOT NULL, height INT NOT NULL, INDEX IDX_758EDEBD55FF4171 (originalasset), PRIMARY KEY(persistence_object_identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB");
Expand All @@ -33,9 +34,9 @@ public function up(Schema $schema): void
* @param Schema $schema
* @return void
*/
public function down(Schema $schema): void
public function down(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->abortIf(!($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform));

$this->addSql("ALTER TABLE typo3_media_domain_model_adjustment_abstractimageadjustment DROP FOREIGN KEY FK_84416FDCA76D06E6");
$this->addSql("DROP TABLE typo3_media_domain_model_adjustment_abstractimageadjustment");
Expand Down
11 changes: 6 additions & 5 deletions Neos.Media/Migrations/Mysql/Version20150228154201.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
namespace Neos\Flow\Persistence\Doctrine\Migrations;

use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Migration that adds position to ImageAdjustments.
Expand All @@ -13,9 +14,9 @@ class Version20150228154201 extends AbstractMigration
* @param Schema $schema
* @return void
*/
public function up(Schema $schema): void
public function up(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->abortIf(!($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform));
$this->addSql("ALTER TABLE typo3_media_domain_model_adjustment_abstractimageadjustment ADD position INT NOT NULL");
$this->addSql("UPDATE typo3_media_domain_model_adjustment_abstractimageadjustment SET position = 10 WHERE dtype = 'typo3_media_adjustment_cropimageadjustment'");
$this->addSql("UPDATE typo3_media_domain_model_adjustment_abstractimageadjustment SET position = 20 WHERE dtype = 'typo3_media_adjustment_resizeimageadjustment'");
Expand All @@ -25,9 +26,9 @@ public function up(Schema $schema): void
* @param Schema $schema
* @return void
*/
public function down(Schema $schema): void
public function down(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->abortIf(!($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform));

$this->addSql("ALTER TABLE typo3_media_domain_model_adjustment_abstractimageadjustment DROP position");
}
Expand Down
11 changes: 6 additions & 5 deletions Neos.Media/Migrations/Mysql/Version20150324185018.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
namespace Neos\Flow\Persistence\Doctrine\Migrations;

use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Note: The migrations date predates the actual change because for Neos it needs to be executed before some other migrations to make everything work correctly.
Expand All @@ -15,9 +16,9 @@ class Version20150324185018 extends AbstractMigration
* @param Schema $schema
* @return void
*/
public function up(Schema $schema): void
public function up(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->abortIf(!($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform));
$this->addSql("ALTER TABLE typo3_media_domain_model_adjustment_abstractimageadjustment ADD allowupscaling TINYINT(1) DEFAULT NULL");
$this->addSql("ALTER TABLE typo3_media_domain_model_thumbnail ADD allowupscaling TINYINT(1) DEFAULT NULL");
}
Expand All @@ -26,9 +27,9 @@ public function up(Schema $schema): void
* @param Schema $schema
* @return void
*/
public function down(Schema $schema): void
public function down(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
$this->abortIf(!($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform));
$this->addSql("ALTER TABLE typo3_media_domain_model_adjustment_abstractimageadjustment DROP allowupscaling");
$this->addSql("ALTER TABLE typo3_media_domain_model_thumbnail DROP allowupscaling");
}
Expand Down
Loading

0 comments on commit 8cb5fb3

Please sign in to comment.