Skip to content

Commit

Permalink
BUGFIX: Add forgotten migration on movedto
Browse files Browse the repository at this point in the history
Change index on "movedto" to unique (was forgotten)

See neos#2475
  • Loading branch information
kdambekalns committed May 3, 2019
1 parent 273cf18 commit 5dbeca1
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
43 changes: 43 additions & 0 deletions Neos.ContentRepository/Migrations/Mysql/Version20190503102824.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
namespace Neos\Flow\Persistence\Doctrine\Migrations;

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

/**
* Change index on "movedto" to unique (was forgotten)
*/
class Version20190503102824 extends AbstractMigration
{
/**
* @return string
*/
public function getDescription()
{
return 'Change index on "movedto" to unique (was forgotten)';
}

/**
* @param Schema $schema
* @return void
* @throws \Doctrine\DBAL\Migrations\AbortMigrationException
*/
public function up(Schema $schema)
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on "mysql".');

$this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX IDX_CE6515692D45FE4D, ADD UNIQUE INDEX UNIQ_CE6515692D45FE4D (movedto)');
}

/**
* @param Schema $schema
* @return void
* @throws \Doctrine\DBAL\Migrations\AbortMigrationException
*/
public function down(Schema $schema)
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on "mysql".');

$this->addSql('ALTER TABLE neos_contentrepository_domain_model_nodedata DROP INDEX UNIQ_CE6515692D45FE4D, ADD INDEX IDX_CE6515692D45FE4D (movedto)');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
namespace Neos\Flow\Persistence\Doctrine\Migrations;

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

/**
* Change index on "movedto" to unique (was forgotten)
*/
class Version20190503102825 extends AbstractMigration
{
/**
* @return string
*/
public function getDescription()
{
return 'Change index on "movedto" to unique (was forgotten)';
}

/**
* @param Schema $schema
* @return void
* @throws \Doctrine\DBAL\Migrations\AbortMigrationException
*/
public function up(Schema $schema)
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on "postgresql".');

$this->addSql('DROP INDEX idx_ce6515692d45fe4d');
$this->addSql('CREATE UNIQUE INDEX UNIQ_CE6515692D45FE4D ON neos_contentrepository_domain_model_nodedata (movedto)');
}

/**
* @param Schema $schema
* @return void
* @throws \Doctrine\DBAL\Migrations\AbortMigrationException
*/
public function down(Schema $schema)
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on "postgresql".');

$this->addSql('DROP INDEX UNIQ_CE6515692D45FE4D');
$this->addSql('CREATE INDEX idx_ce6515692d45fe4d ON neos_contentrepository_domain_model_nodedata (movedto)');
}
}

0 comments on commit 5dbeca1

Please sign in to comment.