Skip to content

Commit

Permalink
Remove SqlitePlatform::getTinyIntTypeDeclarationSQL() and ::getMedium…
Browse files Browse the repository at this point in the history
…IntTypeDeclarationSQL()
  • Loading branch information
morozov committed Jul 16, 2022
1 parent 0bf655e commit 9375711
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 110 deletions.
5 changes: 5 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ awareness about deprecated code.

# Upgrade to 4.0

## BC BREAK: removed `SqlitePlatform` methods.

1. `getTinyIntTypeDeclarationSQL()`,
2. `getMediumIntTypeDeclarationSQL()`.

## BC BREAK: removed `AbstractPlatform` methods.

1. `getDefaultSchemaName()`,
Expand Down
5 changes: 0 additions & 5 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@
See https://github.com/doctrine/dbal/pull/4317
-->
<file name="tests/Functional/LegacyAPITest.php"/>
<!--
TODO: remove in 4.0.0
-->
<referencedMethod name="Doctrine\DBAL\Platforms\SqlitePlatform::getTinyIntTypeDeclarationSQL"/>
<referencedMethod name="Doctrine\DBAL\Platforms\SqlitePlatform::getMediumIntTypeDeclarationSQL"/>
</errorLevel>
</DeprecatedMethod>
<DocblockTypeContradiction>
Expand Down
45 changes: 0 additions & 45 deletions src/Platforms/SqlitePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\TransactionIsolationLevel;
use Doctrine\DBAL\Types;
use Doctrine\Deprecations\Deprecation;
use InvalidArgumentException;

use function array_combine;
Expand Down Expand Up @@ -191,28 +190,6 @@ public function getBigIntTypeDeclarationSQL(array $column): string
return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}

/**
* @deprecated Use {@see getSmallIntTypeDeclarationSQL()} instead.
*
* @param array<string, mixed> $column
*/
public function getTinyIntTypeDeclarationSQL(array $column): string
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5511',
'%s is deprecated. Use getSmallIntTypeDeclarationSQL() instead.',
__METHOD__
);

// SQLite autoincrement is implicit for INTEGER PKs, but not for TINYINT columns
if (! empty($column['autoincrement'])) {
return $this->getIntegerTypeDeclarationSQL($column);
}

return 'TINYINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}

/**
* {@inheritDoc}
*/
Expand All @@ -226,28 +203,6 @@ public function getSmallIntTypeDeclarationSQL(array $column): string
return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}

/**
* @deprecated Use {@see getIntegerTypeDeclarationSQL()} instead.
*
* @param array<string, mixed> $column
*/
public function getMediumIntTypeDeclarationSQL(array $column): string
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5511',
'%s is deprecated. Use getIntegerTypeDeclarationSQL() instead.',
__METHOD__
);

// SQLite autoincrement is implicit for INTEGER PKs, but not for MEDIUMINT columns
if (! empty($column['autoincrement'])) {
return $this->getIntegerTypeDeclarationSQL($column);
}

return 'MEDIUMINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}

/**
* {@inheritDoc}
*/
Expand Down
60 changes: 0 additions & 60 deletions tests/Platforms/SqlitePlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,32 +81,6 @@ public function testIgnoresUnsignedIntegerDeclarationForAutoIncrementalIntegers(
);
}

public function testGeneratesTypeDeclarationForTinyIntegers(): void
{
self::assertEquals(
'TINYINT',
$this->platform->getTinyIntTypeDeclarationSQL([])
);
self::assertEquals(
'INTEGER PRIMARY KEY AUTOINCREMENT',
$this->platform->getTinyIntTypeDeclarationSQL(['autoincrement' => true])
);
self::assertEquals(
'INTEGER PRIMARY KEY AUTOINCREMENT',
$this->platform->getTinyIntTypeDeclarationSQL(
['autoincrement' => true, 'primary' => true]
)
);
self::assertEquals(
'TINYINT',
$this->platform->getTinyIntTypeDeclarationSQL(['unsigned' => false])
);
self::assertEquals(
'TINYINT UNSIGNED',
$this->platform->getTinyIntTypeDeclarationSQL(['unsigned' => true])
);
}

public function testGeneratesTypeDeclarationForSmallIntegers(): void
{
self::assertEquals(
Expand All @@ -117,10 +91,6 @@ public function testGeneratesTypeDeclarationForSmallIntegers(): void
'INTEGER PRIMARY KEY AUTOINCREMENT',
$this->platform->getSmallIntTypeDeclarationSQL(['autoincrement' => true])
);
self::assertEquals(
'INTEGER PRIMARY KEY AUTOINCREMENT',
$this->platform->getTinyIntTypeDeclarationSQL(['autoincrement' => true, 'unsigned' => true])
);
self::assertEquals(
'INTEGER PRIMARY KEY AUTOINCREMENT',
$this->platform->getSmallIntTypeDeclarationSQL(
Expand All @@ -137,36 +107,6 @@ public function testGeneratesTypeDeclarationForSmallIntegers(): void
);
}

public function testGeneratesTypeDeclarationForMediumIntegers(): void
{
self::assertEquals(
'MEDIUMINT',
$this->platform->getMediumIntTypeDeclarationSQL([])
);
self::assertEquals(
'INTEGER PRIMARY KEY AUTOINCREMENT',
$this->platform->getMediumIntTypeDeclarationSQL(['autoincrement' => true])
);
self::assertEquals(
'INTEGER PRIMARY KEY AUTOINCREMENT',
$this->platform->getMediumIntTypeDeclarationSQL(['autoincrement' => true, 'unsigned' => true])
);
self::assertEquals(
'INTEGER PRIMARY KEY AUTOINCREMENT',
$this->platform->getMediumIntTypeDeclarationSQL(
['autoincrement' => true, 'primary' => true]
)
);
self::assertEquals(
'MEDIUMINT',
$this->platform->getMediumIntTypeDeclarationSQL(['unsigned' => false])
);
self::assertEquals(
'MEDIUMINT UNSIGNED',
$this->platform->getMediumIntTypeDeclarationSQL(['unsigned' => true])
);
}

public function testGeneratesTypeDeclarationForIntegers(): void
{
self::assertEquals(
Expand Down

0 comments on commit 9375711

Please sign in to comment.