Browse Source

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

Alejandro Celaya 3 years ago
parent
commit
a0062a62e8

+ 1 - 1
composer.json

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

+ 11 - 3
data/migrations/Version20160819142757.php

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

+ 8 - 0
data/migrations/Version20160820191203.php

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

+ 8 - 0
data/migrations/Version20171021093246.php

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

+ 8 - 0
data/migrations/Version20171022064541.php

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

+ 8 - 0
data/migrations/Version20180801183328.php

@@ -39,4 +39,12 @@ final class Version20180801183328 extends AbstractMigration
     {
         $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;
+    }
 }

+ 10 - 6
data/migrations/Version20180913205455.php

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

+ 8 - 0
data/migrations/Version20180915110857.php

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

+ 10 - 2
data/migrations/Version20181020060559.php

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

+ 8 - 0
data/migrations/Version20181020065148.php

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

+ 8 - 0
data/migrations/Version20181110175521.php

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

+ 8 - 0
data/migrations/Version20190824075137.php

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

+ 8 - 0
data/migrations/Version20190930165521.php

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

+ 8 - 0
data/migrations/Version20191001201532.php

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

+ 8 - 0
data/migrations/Version20191020074522.php

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

+ 13 - 5
data/migrations/Version20200105165647.php

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

+ 11 - 3
data/migrations/Version20200106215144.php

@@ -4,7 +4,7 @@ declare(strict_types=1);
 
 namespace ShlinkMigrations;
 
-use Doctrine\DBAL\DBALException;
+use Doctrine\DBAL\Exception;
 use Doctrine\DBAL\Schema\Schema;
 use Doctrine\DBAL\Types\Types;
 use Doctrine\Migrations\AbstractMigration;
@@ -16,7 +16,7 @@ final class Version20200106215144 extends AbstractMigration
     private const COLUMNS = ['latitude', 'longitude'];
 
     /**
-     * @throws DBALException
+     * @throws Exception
      */
     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
     {
@@ -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;
+    }
 }

+ 8 - 0
data/migrations/Version20200110182849.php

@@ -50,4 +50,12 @@ final class Version20200110182849 extends AbstractMigration
     {
         // 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;
+    }
 }

+ 8 - 0
data/migrations/Version20200323190014.php

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

+ 8 - 0
data/migrations/Version20200503170404.php

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

+ 8 - 0
data/migrations/Version20201023090929.php

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

+ 8 - 0
data/migrations/Version20201102113208.php

@@ -86,4 +86,12 @@ final class Version20201102113208 extends AbstractMigration
         $shortUrls->removeForeignKey('FK_' . 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;
+    }
 }

+ 8 - 0
data/migrations/Version20210102174433.php

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

+ 8 - 0
data/migrations/Version20210118153932.php

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