Replaced use of deprecated class by a non-deprecated one

This commit is contained in:
Alejandro Celaya 2020-01-06 23:08:14 +01:00
parent 886f63d3e4
commit 9c5f5a46b5
10 changed files with 36 additions and 36 deletions

View File

@ -5,7 +5,7 @@ declare(strict_types=1);
namespace ShlinkMigrations; namespace ShlinkMigrations;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;
/** /**
@ -30,12 +30,12 @@ class Version20160820191203 extends AbstractMigration
private function createTagsTable(Schema $schema): void private function createTagsTable(Schema $schema): void
{ {
$table = $schema->createTable('tags'); $table = $schema->createTable('tags');
$table->addColumn('id', Type::BIGINT, [ $table->addColumn('id', Types::BIGINT, [
'unsigned' => true, 'unsigned' => true,
'autoincrement' => true, 'autoincrement' => true,
'notnull' => true, 'notnull' => true,
]); ]);
$table->addColumn('name', Type::STRING, [ $table->addColumn('name', Types::STRING, [
'length' => 255, 'length' => 255,
'notnull' => true, 'notnull' => true,
]); ]);
@ -47,11 +47,11 @@ class Version20160820191203 extends AbstractMigration
private function createShortUrlsInTagsTable(Schema $schema): void private function createShortUrlsInTagsTable(Schema $schema): void
{ {
$table = $schema->createTable('short_urls_in_tags'); $table = $schema->createTable('short_urls_in_tags');
$table->addColumn('short_url_id', Type::BIGINT, [ $table->addColumn('short_url_id', Types::BIGINT, [
'unsigned' => true, 'unsigned' => true,
'notnull' => true, 'notnull' => true,
]); ]);
$table->addColumn('tag_id', Type::BIGINT, [ $table->addColumn('tag_id', Types::BIGINT, [
'unsigned' => true, 'unsigned' => true,
'notnull' => true, 'notnull' => true,
]); ]);

View File

@ -6,7 +6,7 @@ namespace ShlinkMigrations;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaException; use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;
/** /**
@ -24,10 +24,10 @@ class Version20171021093246 extends AbstractMigration
return; return;
} }
$shortUrls->addColumn('valid_since', Type::DATETIME, [ $shortUrls->addColumn('valid_since', Types::DATETIME, [
'notnull' => false, 'notnull' => false,
]); ]);
$shortUrls->addColumn('valid_until', Type::DATETIME, [ $shortUrls->addColumn('valid_until', Types::DATETIME, [
'notnull' => false, 'notnull' => false,
]); ]);
} }

View File

@ -6,7 +6,7 @@ namespace ShlinkMigrations;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaException; use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;
/** /**
@ -24,7 +24,7 @@ class Version20171022064541 extends AbstractMigration
return; return;
} }
$shortUrls->addColumn('max_visits', Type::INTEGER, [ $shortUrls->addColumn('max_visits', Types::INTEGER, [
'unsigned' => true, 'unsigned' => true,
'notnull' => false, 'notnull' => false,
]); ]);

View File

@ -8,7 +8,7 @@ use Doctrine\DBAL\DBALException;
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;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;
/** /**
@ -35,7 +35,7 @@ final class Version20181020060559 extends AbstractMigration
{ {
foreach ($columnNames as $name) { foreach ($columnNames as $name) {
if (! $visitLocations->hasColumn($name)) { if (! $visitLocations->hasColumn($name)) {
$visitLocations->addColumn($name, Type::STRING, ['notnull' => false]); $visitLocations->addColumn($name, Types::STRING, ['notnull' => false]);
} }
} }
} }

View File

@ -6,7 +6,7 @@ namespace ShlinkMigrations;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaException; use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;
final class Version20190930165521 extends AbstractMigration final class Version20190930165521 extends AbstractMigration
@ -22,19 +22,19 @@ final class Version20190930165521 extends AbstractMigration
} }
$domains = $schema->createTable('domains'); $domains = $schema->createTable('domains');
$domains->addColumn('id', Type::BIGINT, [ $domains->addColumn('id', Types::BIGINT, [
'unsigned' => true, 'unsigned' => true,
'autoincrement' => true, 'autoincrement' => true,
'notnull' => true, 'notnull' => true,
]); ]);
$domains->addColumn('authority', Type::STRING, [ $domains->addColumn('authority', Types::STRING, [
'length' => 512, 'length' => 512,
'notnull' => true, 'notnull' => true,
]); ]);
$domains->addUniqueIndex(['authority']); $domains->addUniqueIndex(['authority']);
$domains->setPrimaryKey(['id']); $domains->setPrimaryKey(['id']);
$shortUrls->addColumn('domain_id', Type::BIGINT, [ $shortUrls->addColumn('domain_id', Types::BIGINT, [
'unsigned' => true, 'unsigned' => true,
'notnull' => false, 'notnull' => false,
]); ]);

View File

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core; namespace Shlinkio\Shlink\Core;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder; use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine
@ -13,13 +13,13 @@ $builder = new ClassMetadataBuilder($metadata);
$builder->setTable('domains'); $builder->setTable('domains');
$builder->createField('id', Type::BIGINT) $builder->createField('id', Types::BIGINT)
->columnName('id') ->columnName('id')
->makePrimaryKey() ->makePrimaryKey()
->generatedValue('IDENTITY') ->generatedValue('IDENTITY')
->option('unsigned', true) ->option('unsigned', true)
->build(); ->build();
$builder->createField('authority', Type::STRING) $builder->createField('authority', Types::STRING)
->unique() ->unique()
->build(); ->build();

View File

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core; namespace Shlinkio\Shlink\Core;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder; use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine
use Shlinkio\Shlink\Common\Doctrine\Type\ChronosDateTimeType; use Shlinkio\Shlink\Common\Doctrine\Type\ChronosDateTimeType;
@ -15,19 +15,19 @@ $builder = new ClassMetadataBuilder($metadata);
$builder->setTable('short_urls') $builder->setTable('short_urls')
->setCustomRepositoryClass(Repository\ShortUrlRepository::class); ->setCustomRepositoryClass(Repository\ShortUrlRepository::class);
$builder->createField('id', Type::BIGINT) $builder->createField('id', Types::BIGINT)
->columnName('id') ->columnName('id')
->makePrimaryKey() ->makePrimaryKey()
->generatedValue('IDENTITY') ->generatedValue('IDENTITY')
->option('unsigned', true) ->option('unsigned', true)
->build(); ->build();
$builder->createField('longUrl', Type::STRING) $builder->createField('longUrl', Types::STRING)
->columnName('original_url') ->columnName('original_url')
->length(2048) ->length(2048)
->build(); ->build();
$builder->createField('shortCode', Type::STRING) $builder->createField('shortCode', Types::STRING)
->columnName('short_code') ->columnName('short_code')
->length(255) ->length(255)
->build(); ->build();
@ -46,7 +46,7 @@ $builder->createField('validUntil', ChronosDateTimeType::CHRONOS_DATETIME)
->nullable() ->nullable()
->build(); ->build();
$builder->createField('maxVisits', Type::INTEGER) $builder->createField('maxVisits', Types::INTEGER)
->columnName('max_visits') ->columnName('max_visits')
->nullable() ->nullable()
->build(); ->build();

View File

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core; namespace Shlinkio\Shlink\Core;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder; use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine
@ -14,13 +14,13 @@ $builder = new ClassMetadataBuilder($metadata);
$builder->setTable('tags') $builder->setTable('tags')
->setCustomRepositoryClass(Repository\TagRepository::class); ->setCustomRepositoryClass(Repository\TagRepository::class);
$builder->createField('id', Type::BIGINT) $builder->createField('id', Types::BIGINT)
->columnName('id') ->columnName('id')
->makePrimaryKey() ->makePrimaryKey()
->generatedValue('IDENTITY') ->generatedValue('IDENTITY')
->option('unsigned', true) ->option('unsigned', true)
->build(); ->build();
$builder->createField('name', Type::STRING) $builder->createField('name', Types::STRING)
->unique() ->unique()
->build(); ->build();

View File

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core; namespace Shlinkio\Shlink\Core;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder; use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine
use Shlinkio\Shlink\Common\Doctrine\Type\ChronosDateTimeType; use Shlinkio\Shlink\Common\Doctrine\Type\ChronosDateTimeType;
@ -16,14 +16,14 @@ $builder = new ClassMetadataBuilder($metadata);
$builder->setTable('visits') $builder->setTable('visits')
->setCustomRepositoryClass(Repository\VisitRepository::class); ->setCustomRepositoryClass(Repository\VisitRepository::class);
$builder->createField('id', Type::BIGINT) $builder->createField('id', Types::BIGINT)
->columnName('id') ->columnName('id')
->makePrimaryKey() ->makePrimaryKey()
->generatedValue('IDENTITY') ->generatedValue('IDENTITY')
->option('unsigned', true) ->option('unsigned', true)
->build(); ->build();
$builder->createField('referer', Type::STRING) $builder->createField('referer', Types::STRING)
->nullable() ->nullable()
->length(Visitor::REFERER_MAX_LENGTH) ->length(Visitor::REFERER_MAX_LENGTH)
->build(); ->build();
@ -32,13 +32,13 @@ $builder->createField('date', ChronosDateTimeType::CHRONOS_DATETIME)
->columnName('`date`') ->columnName('`date`')
->build(); ->build();
$builder->createField('remoteAddr', Type::STRING) $builder->createField('remoteAddr', Types::STRING)
->columnName('remote_addr') ->columnName('remote_addr')
->length(Visitor::REMOTE_ADDRESS_MAX_LENGTH) ->length(Visitor::REMOTE_ADDRESS_MAX_LENGTH)
->nullable() ->nullable()
->build(); ->build();
$builder->createField('userAgent', Type::STRING) $builder->createField('userAgent', Types::STRING)
->columnName('user_agent') ->columnName('user_agent')
->length(Visitor::USER_AGENT_MAX_LENGTH) ->length(Visitor::USER_AGENT_MAX_LENGTH)
->nullable() ->nullable()

View File

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Rest; namespace Shlinkio\Shlink\Rest;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder; use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine use Doctrine\ORM\Mapping\ClassMetadata; // @codingStandardsIgnoreLine
use Shlinkio\Shlink\Common\Doctrine\Type\ChronosDateTimeType; use Shlinkio\Shlink\Common\Doctrine\Type\ChronosDateTimeType;
@ -14,13 +14,13 @@ $builder = new ClassMetadataBuilder($metadata);
$builder->setTable('api_keys'); $builder->setTable('api_keys');
$builder->createField('id', Type::BIGINT) $builder->createField('id', Types::BIGINT)
->makePrimaryKey() ->makePrimaryKey()
->generatedValue('IDENTITY') ->generatedValue('IDENTITY')
->option('unsigned', true) ->option('unsigned', true)
->build(); ->build();
$builder->createField('key', Type::STRING) $builder->createField('key', Types::STRING)
->columnName('`key`') ->columnName('`key`')
->unique() ->unique()
->build(); ->build();
@ -30,5 +30,5 @@ $builder->createField('expirationDate', ChronosDateTimeType::CHRONOS_DATETIME)
->nullable() ->nullable()
->build(); ->build();
$builder->createField('enabled', Type::BOOLEAN) $builder->createField('enabled', Types::BOOLEAN)
->build(); ->build();