diff --git a/composer.json b/composer.json index 16def607..bd00a90a 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "cakephp/chronos": "^1.2", "cocur/slugify": "^3.0", "doctrine/cache": "^1.6", - "doctrine/migrations": "^1.4", + "doctrine/migrations": "^2.0", "doctrine/orm": "^2.5", "endroid/qr-code": "^1.7", "firebase/php-jwt": "^4.0", diff --git a/data/migrations/Version20160819142757.php b/data/migrations/Version20160819142757.php index cd6a3f5a..5c568b49 100644 --- a/data/migrations/Version20160819142757.php +++ b/data/migrations/Version20160819142757.php @@ -3,21 +3,24 @@ declare(strict_types=1); namespace ShlinkMigrations; -use Doctrine\DBAL\Migrations\AbstractMigration; +use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Schema\Schema; +use Doctrine\DBAL\Schema\SchemaException; +use Doctrine\Migrations\AbstractMigration; /** * Auto-generated Migration: Please modify to your needs! */ class Version20160819142757 extends AbstractMigration { - const MYSQL = 'mysql'; - const SQLITE = 'sqlite'; + private const MYSQL = 'mysql'; + private const SQLITE = 'sqlite'; /** - * @param Schema $schema + * @throws DBALException + * @throws SchemaException */ - public function up(Schema $schema) + public function up(Schema $schema): void { $db = $this->connection->getDatabasePlatform()->getName(); $table = $schema->getTable('short_urls'); @@ -31,9 +34,9 @@ class Version20160819142757 extends AbstractMigration } /** - * @param Schema $schema + * @throws DBALException */ - public function down(Schema $schema) + public function down(Schema $schema): void { $db = $this->connection->getDatabasePlatform()->getName(); } diff --git a/data/migrations/Version20160820191203.php b/data/migrations/Version20160820191203.php index 44ccf9c3..81544097 100644 --- a/data/migrations/Version20160820191203.php +++ b/data/migrations/Version20160820191203.php @@ -3,19 +3,16 @@ declare(strict_types=1); namespace ShlinkMigrations; -use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Types\Type; +use Doctrine\Migrations\AbstractMigration; /** * Auto-generated Migration: Please modify to your needs! */ class Version20160820191203 extends AbstractMigration { - /** - * @param Schema $schema - */ - public function up(Schema $schema) + public function up(Schema $schema): void { // Check if the tables already exist $tables = $schema->getTables(); @@ -29,7 +26,7 @@ class Version20160820191203 extends AbstractMigration $this->createShortUrlsInTagsTable($schema); } - protected function createTagsTable(Schema $schema) + private function createTagsTable(Schema $schema): void { $table = $schema->createTable('tags'); $table->addColumn('id', Type::BIGINT, [ @@ -46,7 +43,7 @@ class Version20160820191203 extends AbstractMigration $table->setPrimaryKey(['id']); } - protected function createShortUrlsInTagsTable(Schema $schema) + private function createShortUrlsInTagsTable(Schema $schema): void { $table = $schema->createTable('short_urls_in_tags'); $table->addColumn('short_url_id', Type::BIGINT, [ @@ -70,10 +67,7 @@ class Version20160820191203 extends AbstractMigration $table->setPrimaryKey(['short_url_id', 'tag_id']); } - /** - * @param Schema $schema - */ - public function down(Schema $schema) + public function down(Schema $schema): void { $schema->dropTable('short_urls_in_tags'); $schema->dropTable('tags'); diff --git a/data/migrations/Version20171021093246.php b/data/migrations/Version20171021093246.php index 7996ba6c..e510d5a7 100644 --- a/data/migrations/Version20171021093246.php +++ b/data/migrations/Version20171021093246.php @@ -3,10 +3,10 @@ declare(strict_types=1); namespace ShlinkMigrations; -use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\SchemaException; use Doctrine\DBAL\Types\Type; +use Doctrine\Migrations\AbstractMigration; /** * Auto-generated Migration: Please modify to your needs! @@ -14,10 +14,9 @@ use Doctrine\DBAL\Types\Type; class Version20171021093246 extends AbstractMigration { /** - * @param Schema $schema * @throws SchemaException */ - public function up(Schema $schema) + public function up(Schema $schema): void { $shortUrls = $schema->getTable('short_urls'); if ($shortUrls->hasColumn('valid_since')) { @@ -33,10 +32,9 @@ class Version20171021093246 extends AbstractMigration } /** - * @param Schema $schema * @throws SchemaException */ - public function down(Schema $schema) + public function down(Schema $schema): void { $shortUrls = $schema->getTable('short_urls'); if (! $shortUrls->hasColumn('valid_since')) { diff --git a/data/migrations/Version20171022064541.php b/data/migrations/Version20171022064541.php index ef0447aa..fb2f7cc0 100644 --- a/data/migrations/Version20171022064541.php +++ b/data/migrations/Version20171022064541.php @@ -3,10 +3,10 @@ declare(strict_types=1); namespace ShlinkMigrations; -use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\SchemaException; use Doctrine\DBAL\Types\Type; +use Doctrine\Migrations\AbstractMigration; /** * Auto-generated Migration: Please modify to your needs! @@ -14,10 +14,9 @@ use Doctrine\DBAL\Types\Type; class Version20171022064541 extends AbstractMigration { /** - * @param Schema $schema * @throws SchemaException */ - public function up(Schema $schema) + public function up(Schema $schema): void { $shortUrls = $schema->getTable('short_urls'); if ($shortUrls->hasColumn('max_visits')) { @@ -31,10 +30,9 @@ class Version20171022064541 extends AbstractMigration } /** - * @param Schema $schema * @throws SchemaException */ - public function down(Schema $schema) + public function down(Schema $schema): void { $shortUrls = $schema->getTable('short_urls'); if (! $shortUrls->hasColumn('max_visits')) {