Ensured all migrations are non-transactional, which allows woring around an issue in doctrine-migrations

This commit is contained in:
Alejandro Celaya 2021-03-12 11:52:43 +01:00
parent 0f2bd77ebc
commit a0062a62e8
24 changed files with 200 additions and 20 deletions

View file

@ -70,7 +70,7 @@
"phpunit/phpunit": "^9.5", "phpunit/phpunit": "^9.5",
"roave/security-advisories": "dev-master", "roave/security-advisories": "dev-master",
"shlinkio/php-coding-standard": "~2.1.1", "shlinkio/php-coding-standard": "~2.1.1",
"shlinkio/shlink-test-utils": "^2.0", "shlinkio/shlink-test-utils": "^2.1",
"symfony/var-dumper": "^5.2", "symfony/var-dumper": "^5.2",
"veewee/composer-run-parallel": "^0.1.0" "veewee/composer-run-parallel": "^0.1.0"
}, },

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace ShlinkMigrations; namespace ShlinkMigrations;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaException; use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;
@ -18,7 +18,7 @@ class Version20160819142757 extends AbstractMigration
private const SQLITE = 'sqlite'; private const SQLITE = 'sqlite';
/** /**
* @throws DBALException * @throws Exception
* @throws SchemaException * @throws SchemaException
*/ */
public function up(Schema $schema): void public function up(Schema $schema): void
@ -35,10 +35,18 @@ class Version20160819142757 extends AbstractMigration
} }
/** /**
* @throws DBALException * @throws Exception
*/ */
public function down(Schema $schema): void public function down(Schema $schema): void
{ {
$db = $this->connection->getDatabasePlatform()->getName(); $db = $this->connection->getDatabasePlatform()->getName();
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -73,4 +73,12 @@ class Version20160820191203 extends AbstractMigration
$schema->dropTable('short_urls_in_tags'); $schema->dropTable('short_urls_in_tags');
$schema->dropTable('tags'); $schema->dropTable('tags');
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -45,4 +45,12 @@ class Version20171021093246 extends AbstractMigration
$shortUrls->dropColumn('valid_since'); $shortUrls->dropColumn('valid_since');
$shortUrls->dropColumn('valid_until'); $shortUrls->dropColumn('valid_until');
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -42,4 +42,12 @@ class Version20171022064541 extends AbstractMigration
$shortUrls->dropColumn('max_visits'); $shortUrls->dropColumn('max_visits');
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -39,4 +39,12 @@ final class Version20180801183328 extends AbstractMigration
{ {
$schema->getTable('short_urls')->getColumn('short_code')->setLength($size); $schema->getTable('short_urls')->getColumn('short_code')->setLength($size);
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace ShlinkMigrations; namespace ShlinkMigrations;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;
use PDO; use PDO;
@ -16,15 +16,13 @@ use Shlinkio\Shlink\Common\Util\IpAddress;
*/ */
final class Version20180913205455 extends AbstractMigration final class Version20180913205455 extends AbstractMigration
{ {
/**
*/
public function up(Schema $schema): void public function up(Schema $schema): void
{ {
// Nothing to create // Nothing to create
} }
/** /**
* @throws DBALException * @throws Exception
*/ */
public function postUp(Schema $schema): void public function postUp(Schema $schema): void
{ {
@ -64,10 +62,16 @@ final class Version20180913205455 extends AbstractMigration
} }
} }
/**
*/
public function down(Schema $schema): void public function down(Schema $schema): void
{ {
// Nothing to rollback // Nothing to rollback
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -47,4 +47,12 @@ final class Version20180915110857 extends AbstractMigration
{ {
// Nothing to run // Nothing to run
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace ShlinkMigrations; namespace ShlinkMigrations;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaException; use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Schema\Table;
@ -42,7 +42,7 @@ final class Version20181020060559 extends AbstractMigration
/** /**
* @throws SchemaException * @throws SchemaException
* @throws DBALException * @throws Exception
*/ */
public function postUp(Schema $schema): void public function postUp(Schema $schema): void
{ {
@ -65,4 +65,12 @@ final class Version20181020060559 extends AbstractMigration
{ {
// No down // No down
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -38,4 +38,12 @@ final class Version20181020065148 extends AbstractMigration
{ {
// No down // No down
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -34,4 +34,12 @@ final class Version20181110175521 extends AbstractMigration
{ {
return $schema->getTable('visits')->getColumn('user_agent'); return $schema->getTable('visits')->getColumn('user_agent');
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -34,4 +34,12 @@ final class Version20190824075137 extends AbstractMigration
{ {
return $schema->getTable('visits')->getColumn('referer'); return $schema->getTable('visits')->getColumn('referer');
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -52,4 +52,12 @@ final class Version20190930165521 extends AbstractMigration
$schema->getTable('short_urls')->dropColumn('domain_id'); $schema->getTable('short_urls')->dropColumn('domain_id');
$schema->dropTable('domains'); $schema->dropTable('domains');
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -46,4 +46,12 @@ final class Version20191001201532 extends AbstractMigration
$shortUrls->dropIndex('unique_short_code_plus_domain'); $shortUrls->dropIndex('unique_short_code_plus_domain');
$shortUrls->addUniqueIndex(['short_code']); $shortUrls->addUniqueIndex(['short_code']);
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -34,4 +34,12 @@ final class Version20191020074522 extends AbstractMigration
{ {
return $schema->getTable('short_urls')->getColumn('original_url'); return $schema->getTable('short_urls')->getColumn('original_url');
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace ShlinkMigrations; namespace ShlinkMigrations;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types; use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;
@ -16,7 +16,7 @@ final class Version20200105165647 extends AbstractMigration
private const COLUMNS = ['lat' => 'latitude', 'lon' => 'longitude']; private const COLUMNS = ['lat' => 'latitude', 'lon' => 'longitude'];
/** /**
* @throws DBALException * @throws Exception
*/ */
public function preUp(Schema $schema): void public function preUp(Schema $schema): void
{ {
@ -43,7 +43,7 @@ final class Version20200105165647 extends AbstractMigration
} }
/** /**
* @throws DBALException * @throws Exception
*/ */
public function up(Schema $schema): void public function up(Schema $schema): void
{ {
@ -57,7 +57,7 @@ final class Version20200105165647 extends AbstractMigration
} }
/** /**
* @throws DBALException * @throws Exception
*/ */
public function postUp(Schema $schema): void public function postUp(Schema $schema): void
{ {
@ -83,7 +83,7 @@ final class Version20200105165647 extends AbstractMigration
} }
/** /**
* @throws DBALException * @throws Exception
*/ */
public function down(Schema $schema): void public function down(Schema $schema): void
{ {
@ -93,4 +93,12 @@ final class Version20200105165647 extends AbstractMigration
$visitLocations->dropColumn($colName); $visitLocations->dropColumn($colName);
} }
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace ShlinkMigrations; namespace ShlinkMigrations;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types; use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;
@ -16,7 +16,7 @@ final class Version20200106215144 extends AbstractMigration
private const COLUMNS = ['latitude', 'longitude']; private const COLUMNS = ['latitude', 'longitude'];
/** /**
* @throws DBALException * @throws Exception
*/ */
public function up(Schema $schema): void public function up(Schema $schema): void
{ {
@ -32,7 +32,7 @@ final class Version20200106215144 extends AbstractMigration
} }
/** /**
* @throws DBALException * @throws Exception
*/ */
public function down(Schema $schema): void public function down(Schema $schema): void
{ {
@ -44,4 +44,12 @@ final class Version20200106215144 extends AbstractMigration
]); ]);
} }
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -50,4 +50,12 @@ final class Version20200110182849 extends AbstractMigration
{ {
// No need (and no way) to undo this migration // No need (and no way) to undo this migration
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -42,4 +42,12 @@ final class Version20200323190014 extends AbstractMigration
$visitLocations->dropColumn('is_empty'); $visitLocations->dropColumn('is_empty');
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -24,4 +24,12 @@ final class Version20200503170404 extends AbstractMigration
$this->skipIf(! $visits->hasIndex(self::INDEX_NAME)); $this->skipIf(! $visits->hasIndex(self::INDEX_NAME));
$visits->dropIndex(self::INDEX_NAME); $visits->dropIndex(self::INDEX_NAME);
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -41,4 +41,12 @@ final class Version20201023090929 extends AbstractMigration
$shortUrls->dropColumn('import_original_short_code'); $shortUrls->dropColumn('import_original_short_code');
$shortUrls->dropIndex('unique_imports'); $shortUrls->dropIndex('unique_imports');
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -86,4 +86,12 @@ final class Version20201102113208 extends AbstractMigration
$shortUrls->removeForeignKey('FK_' . self::API_KEY_COLUMN); $shortUrls->removeForeignKey('FK_' . self::API_KEY_COLUMN);
$shortUrls->dropColumn(self::API_KEY_COLUMN); $shortUrls->dropColumn(self::API_KEY_COLUMN);
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -49,4 +49,12 @@ final class Version20210102174433 extends AbstractMigration
$schema->getTable(self::TABLE_NAME)->dropIndex('UQ_role_plus_api_key'); $schema->getTable(self::TABLE_NAME)->dropIndex('UQ_role_plus_api_key');
$schema->dropTable(self::TABLE_NAME); $schema->dropTable(self::TABLE_NAME);
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }

View file

@ -23,4 +23,12 @@ final class Version20210118153932 extends AbstractMigration
public function down(Schema $schema): void public function down(Schema $schema): void
{ {
} }
/**
* @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
*/
public function isTransactional(): bool
{
return false;
}
} }