Skip to content

Commit d1a5672

Browse files
committed
Remove support for "unique" and "check" column properties
1 parent 039b945 commit d1a5672

File tree

4 files changed

+13
-92
lines changed

4 files changed

+13
-92
lines changed

UPGRADE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ awareness about deprecated code.
88

99
# Upgrade to 4.0
1010

11+
## BC BREAK: removed support for "unique" and "check" column properties.
12+
13+
The "unique" and "check" column properties are no longer supported.
14+
1115
## BC BREAK: removed default precision and scale of decimal columns.
1216

1317
The DBAL no longer provides default values for precision and scale of decimal columns.

src/Platforms/AbstractPlatform.php

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
use Doctrine\DBAL\Types;
3939
use Doctrine\DBAL\Types\Exception\TypeNotFound;
4040
use Doctrine\DBAL\Types\Type;
41-
use Doctrine\Deprecations\Deprecation;
4241
use InvalidArgumentException;
4342
use UnexpectedValueException;
4443

@@ -1489,19 +1488,15 @@ protected function getRenameIndexSQL(string $oldIndexName, Index $index, string
14891488
* Integer value that determines the maximum length of the text
14901489
* column. If this argument is missing the column should be
14911490
* declared to have the longest length allowed by the DBMS.
1492-
*
14931491
* default
14941492
* Text value to be used as default for this column.
1495-
*
14961493
* notnull
14971494
* Boolean flag that indicates whether this column is constrained
14981495
* to not be set to null.
14991496
* charset
15001497
* Text value with the default CHARACTER SET for this column.
15011498
* collation
15021499
* Text value with the default COLLATION for this column.
1503-
* unique
1504-
* unique constraint
15051500
*/
15061501
public function getColumnDeclarationListSQL(array $columns): string
15071502
{
@@ -1529,21 +1524,15 @@ public function getColumnDeclarationListSQL(array $columns): string
15291524
* Integer value that determines the maximum length of the text
15301525
* column. If this argument is missing the column should be
15311526
* declared to have the longest length allowed by the DBMS.
1532-
*
15331527
* default
15341528
* Text value to be used as default for this column.
1535-
*
15361529
* notnull
15371530
* Boolean flag that indicates whether this column is constrained
15381531
* to not be set to null.
15391532
* charset
15401533
* Text value with the default CHARACTER SET for this column.
15411534
* collation
15421535
* Text value with the default COLLATION for this column.
1543-
* unique
1544-
* unique constraint
1545-
* check
1546-
* column check constraint
15471536
* columnDefinition
15481537
* a string that defines the complete column
15491538
*
@@ -1566,32 +1555,8 @@ public function getColumnDeclarationSQL(string $name, array $column): string
15661555

15671556
$notnull = ! empty($column['notnull']) ? ' NOT NULL' : '';
15681557

1569-
if (! empty($column['unique'])) {
1570-
Deprecation::trigger(
1571-
'doctrine/dbal',
1572-
'https://github.com/doctrine/dbal/pull/5656',
1573-
'The usage of the "unique" column property is deprecated. Use unique constraints instead.',
1574-
);
1575-
1576-
$unique = ' UNIQUE';
1577-
} else {
1578-
$unique = '';
1579-
}
1580-
1581-
if (! empty($column['check'])) {
1582-
Deprecation::trigger(
1583-
'doctrine/dbal',
1584-
'https://github.com/doctrine/dbal/pull/5656',
1585-
'The usage of the "check" column property is deprecated.',
1586-
);
1587-
1588-
$check = ' ' . $column['check'];
1589-
} else {
1590-
$check = '';
1591-
}
1592-
15931558
$typeDecl = $column['type']->getSQLDeclaration($column, $this);
1594-
$declaration = $typeDecl . $charset . $default . $notnull . $unique . $check . $collation;
1559+
$declaration = $typeDecl . $charset . $default . $notnull . $collation;
15951560

15961561
if ($this->supportsInlineColumnComments() && isset($column['comment']) && $column['comment'] !== '') {
15971562
$declaration .= ' ' . $this->getInlineColumnCommentSQL($column['comment']);

src/Platforms/OraclePlatform.php

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ public function getAlterTableSQL(TableDiff $diff): array
657657
public function getColumnDeclarationSQL(string $name, array $column): string
658658
{
659659
if (isset($column['columnDefinition'])) {
660-
$columnDef = $column['columnDefinition'];
660+
$declaration = $column['columnDefinition'];
661661
} else {
662662
$default = $this->getDefaultValueDeclarationSQL($column);
663663

@@ -667,35 +667,11 @@ public function getColumnDeclarationSQL(string $name, array $column): string
667667
$notnull = $column['notnull'] ? ' NOT NULL' : ' NULL';
668668
}
669669

670-
if (! empty($column['unique'])) {
671-
Deprecation::trigger(
672-
'doctrine/dbal',
673-
'https://github.com/doctrine/dbal/pull/5656',
674-
'The usage of the "unique" column property is deprecated. Use unique constraints instead.',
675-
);
676-
677-
$unique = ' UNIQUE';
678-
} else {
679-
$unique = '';
680-
}
681-
682-
if (! empty($column['check'])) {
683-
Deprecation::trigger(
684-
'doctrine/dbal',
685-
'https://github.com/doctrine/dbal/pull/5656',
686-
'The usage of the "check" column property is deprecated.',
687-
);
688-
689-
$check = ' ' . $column['check'];
690-
} else {
691-
$check = '';
692-
}
693-
694-
$typeDecl = $column['type']->getSQLDeclaration($column, $this);
695-
$columnDef = $typeDecl . $default . $notnull . $unique . $check;
670+
$typeDecl = $column['type']->getSQLDeclaration($column, $this);
671+
$declaration = $typeDecl . $default . $notnull;
696672
}
697673

698-
return $name . ' ' . $columnDef;
674+
return $name . ' ' . $declaration;
699675
}
700676

701677
/**

src/Platforms/SQLServerPlatform.php

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,42 +1203,18 @@ public function getBlobTypeDeclarationSQL(array $column): string
12031203
public function getColumnDeclarationSQL(string $name, array $column): string
12041204
{
12051205
if (isset($column['columnDefinition'])) {
1206-
$columnDef = $column['columnDefinition'];
1206+
$declaration = $column['columnDefinition'];
12071207
} else {
12081208
$collation = ! empty($column['collation']) ?
12091209
' ' . $this->getColumnCollationDeclarationSQL($column['collation']) : '';
12101210

12111211
$notnull = ! empty($column['notnull']) ? ' NOT NULL' : '';
12121212

1213-
if (! empty($column['unique'])) {
1214-
Deprecation::trigger(
1215-
'doctrine/dbal',
1216-
'https://github.com/doctrine/dbal/pull/5656',
1217-
'The usage of the "unique" column property is deprecated. Use unique constraints instead.',
1218-
);
1219-
1220-
$unique = ' UNIQUE';
1221-
} else {
1222-
$unique = '';
1223-
}
1224-
1225-
if (! empty($column['check'])) {
1226-
Deprecation::trigger(
1227-
'doctrine/dbal',
1228-
'https://github.com/doctrine/dbal/pull/5656',
1229-
'The usage of the "check" column property is deprecated.',
1230-
);
1231-
1232-
$check = ' ' . $column['check'];
1233-
} else {
1234-
$check = '';
1235-
}
1236-
1237-
$typeDecl = $column['type']->getSQLDeclaration($column, $this);
1238-
$columnDef = $typeDecl . $collation . $notnull . $unique . $check;
1213+
$typeDecl = $column['type']->getSQLDeclaration($column, $this);
1214+
$declaration = $typeDecl . $collation . $notnull;
12391215
}
12401216

1241-
return $name . ' ' . $columnDef;
1217+
return $name . ' ' . $declaration;
12421218
}
12431219

12441220
/**

0 commit comments

Comments
 (0)