Skip to content

Merge 4.3.x into 5.0.x #6896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c0ed5f9
Fix merging driver options in the pdo_sqlsrv driver test
morozov Mar 23, 2025
83cf7e1
Merge pull request #6871 from morozov/fix-pdo-sql-driver-test
morozov Mar 24, 2025
2180588
Clean up Table::renameIndex() code
morozov Mar 31, 2025
feed861
Merge pull request #6882 from morozov/cleanup-rename-index
morozov Mar 31, 2025
23409bf
Enforce non-positive indexed column length at runtime
morozov Apr 2, 2025
dea062e
Rework index column introspection on Postgres
morozov Apr 3, 2025
26e0d7d
Require PHP 8.3
morozov Apr 4, 2025
3c388bd
Introduce forward-compatible Index API
morozov Apr 2, 2025
a038c80
Deprecate Index features
morozov Mar 27, 2025
386959b
Introduce IndexEditor
morozov Mar 31, 2025
fb73632
Merge pull request #6886 from morozov/index-deprecations
morozov Apr 5, 2025
1332fee
Do not trim single quote in comments on SQLite
morozov Apr 6, 2025
b59e163
Merge pull request #6889 from morozov/php-8.3
morozov Apr 6, 2025
1a328d5
PHPUnit 11
morozov Apr 4, 2025
91e9712
Merge pull request #6887 from morozov/postgres-index-introspection
morozov Apr 6, 2025
a11db88
Merge pull request #6892 from morozov/sqlite-quote-comment
morozov Apr 6, 2025
790a5f0
Merge pull request #6894 from morozov/phpunit-11
morozov Apr 6, 2025
0d70017
Introduce ComparatorConfig::withReportModifiedIndexes()
morozov Apr 5, 2025
8a1acdc
Merge pull request #6890 from morozov/issues/6880
morozov Apr 6, 2025
3cb172a
Merge pull request #6895 from doctrine/4.2.x
morozov Apr 6, 2025
6d493f6
Merge branch '4.3.x' into 5.0.x
morozov Apr 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ environment:
- db: mssql
driver: sqlsrv
db_version: sql2017
php: 8.1
php: 8.3
- db: mssql
driver: pdo_sqlsrv
db_version: sql2017
php: 8.1
php: 8.3

init:
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;C:\tools\composer;%PATH%
Expand Down Expand Up @@ -64,18 +64,19 @@ install:
Add-Content php.ini "`n extension=php_sqlite3.dll"
Add-Content php.ini "`n extension=php_curl.dll"
$DLLVersion = "5.10.0"
$DLLVersion = "5.12.0"
$VSVersion = "vs16"
cd c:\tools\php\ext
$source = "https://windows.php.net/downloads/pecl/releases/sqlsrv/$($DLLVersion)/php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vs16-x64.zip"
$destination = "c:\tools\php\ext\php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vs16-x64.zip"
$source = "https://downloads.php.net/~windows/pecl/releases/sqlsrv/$($DLLVersion)/php_sqlsrv-$($DLLVersion)-$($env:php)-nts-$($VSVersion)-x64.zip"
$destination = "c:\tools\php\ext\php_sqlsrv-$($DLLVersion)-$($env:php)-nts-$($VSVersion)-x64.zip"
Invoke-WebRequest $source -OutFile $destination
7z x -y php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vs16-x64.zip > $null
$source = "https://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/$($DLLVersion)/php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vs16-x64.zip"
$destination = "c:\tools\php\ext\php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vs16-x64.zip"
7z x -y php_sqlsrv-$($DLLVersion)-$($env:php)-nts-$($VSVersion)-x64.zip > $null
$source = "https://downloads.php.net/~windows/pecl/releases/pdo_sqlsrv/$($DLLVersion)/php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-$($VSVersion)-x64.zip"
$destination = "c:\tools\php\ext\php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-$($VSVersion)-x64.zip"
Invoke-WebRequest $source -OutFile $destination
7z x -y php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vs16-x64.zip > $null
7z x -y php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-$($VSVersion)-x64.zip > $null
$DLLVersion = (Invoke-WebRequest "https://pecl.php.net/rest/r/pcov/stable.txt").Content
Invoke-WebRequest https://downloads.php.net/~windows/pecl/releases/pcov/$($DLLVersion)/php_pcov-$($DLLVersion)-$($env:php)-nts-vs16-$($env:platform).zip -OutFile pcov.zip
Invoke-WebRequest https://downloads.php.net/~windows/pecl/releases/pcov/$($DLLVersion)/php_pcov-$($DLLVersion)-$($env:php)-nts-$($VSVersion)-$($env:platform).zip -OutFile pcov.zip
7z x -y pcov.zip > $null
Remove-Item c:\tools\php\* -include .zip
cd c:\tools\php
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- "pdo_sqlite"
include:
- os: "ubuntu-20.04"
php-version: "8.1"
php-version: "8.3"
dependencies: "lowest"
extension: "pdo_sqlite"
- os: "ubuntu-22.04"
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
- "21"
- "23"
include:
- php-version: "8.1"
- php-version: "8.3"
oracle-version: "23"
- php-version: "8.5"
oracle-version: "23"
Expand Down Expand Up @@ -166,7 +166,7 @@ jobs:
- "21"
- "23"
include:
- php-version: "8.1"
- php-version: "8.3"
oracle-version: "23"
- php-version: "8.5"
oracle-version: "23"
Expand Down Expand Up @@ -231,10 +231,10 @@ jobs:
- "pgsql"
- "pdo_pgsql"
include:
- php-version: "8.1"
- php-version: "8.3"
postgres-version: "17"
extension: "pgsql"
- php-version: "8.1"
- php-version: "8.3"
postgres-version: "17"
extension: "pdo_pgsql"
- php-version: "8.5"
Expand Down Expand Up @@ -308,10 +308,10 @@ jobs:
- "mysqli"
- "pdo_mysql"
include:
- php-version: "8.1"
- php-version: "8.3"
mariadb-version: "11.4"
extension: "mysqli"
- php-version: "8.1"
- php-version: "8.3"
mariadb-version: "11.4"
extension: "pdo_mysql"
- php-version: "8.5"
Expand Down Expand Up @@ -381,10 +381,10 @@ jobs:
- ""
include:
- config-file-suffix: "-tls"
php-version: "8.1"
php-version: "8.3"
mysql-version: "9.1"
extension: "mysqli"
- php-version: "8.1"
- php-version: "8.3"
mysql-version: "9.1"
extension: "mysqli"
- php-version: "8.5"
Expand Down Expand Up @@ -447,7 +447,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.3"
- "8.4"
- "8.5"
extension:
Expand All @@ -457,10 +457,10 @@ jobs:
- "Latin1_General_100_CI_AS_SC_UTF8"
include:
- collation: "Latin1_General_100_CS_AS_SC_UTF8"
php-version: "8.1"
php-version: "8.3"
extension: "sqlsrv"
- collation: "Latin1_General_100_CS_AS_SC_UTF8"
php-version: "8.1"
php-version: "8.3"
extension: "pdo_sqlsrv"

services:
Expand Down Expand Up @@ -514,7 +514,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.3"
- "8.4"
- "8.5"

Expand Down Expand Up @@ -582,7 +582,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.3"

steps:
- name: "Checkout"
Expand Down
39 changes: 35 additions & 4 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,34 @@ all drivers and middleware.

# Upgrade to 4.3

## Deprecated `Index` methods, properties and behavior

The following `Index` methods and properties have been deprecated:

- `Index::getColumns()`, `Index::getQuotedColumns()`, `Index::getUnquotedColumns()`,
`Index::$_columns` – use `Index::getIndexedColumns()` instead.
- `Index::isSimpleIndex()`, `Index::isUnique()`, `Index::$_isUnique` – use `Index::getType()` and compare with
`IndexType::REGULAR` or `IndexType::UNIQUE` instead.
- `Index::addFlag()`, `Index::removeFlag()`, `Index::getFlags()`, `Index::hasFlag()`, `Index::$_flags` – use
`IndexEditor::setType()`, `Index::getType()`, `IndexEditor::setIsClustered()` and `Index::isClustered()` instead.
- `Index::getOption()`, `Index::hasOption()` and `Index::getOptions()` – use `Index::getIndexedColumns()` and
`Index::getPredicate()` instead.
- `Index::overrules()`, `Index::hasColumnAtPosition()` – no replacement provided.
- `AbstractPlatform::supportsColumnLengthIndexes()` – no replacement provided.

Additionally,
1. Instantiation of an index without columns is deprecated.
2. The `Index::spansColumns()` method has been marked as internal.
3. Passing an empty string as partial index predicate has been deprecated.
4. The `Index` constructor has been marked as internal. Use `Index::editor()` to instantiate an editor and
`IndexEditor::create()` to create an index.

The following conflicting index configurations have been deprecated:
1. Spatial index with column lengths specified.
2. Clustered fulltext or spatial index.
3. Partial fulltext or spatial index.
4. Clustered partial index.

## Deprecated features related to primary key constraints

1. The `AbstractPlatform::getCreatePrimaryKeySQL()` method has been deprecated. Use the schema manager to create and
Expand Down Expand Up @@ -279,9 +307,12 @@ of the primary key constraint is deprecated. Instead, drop the auto-increment at
Passing a non-empty `$modifiedIndexes` value to the `TableDiff` constructor is deprecated. Instead, pass dropped
indexes via `$droppedIndexes` and added indexes via `$addedIndexes`.

The `TableDiff::getModifiedIndexes()` method has been deprecated. The old version of the index is included in the return
value of `TableDiff::getDroppedIndexes()`, the new version is included in the return value of
`TableDiff::getAddedIndexes()`.
Detection of modified indexes is deprecated. Please disable it by configuring the comparator using
`ComparatorConfig::withReportModifiedIndexes(false)`. With this configuration, the old version of the index will be
included in the return value of `TableDiff::getDroppedIndexes()`, and the new version will be included in the return
value of `TableDiff::getAddedIndexes()`.

The `TableDiff::getModifiedIndexes()` method has been deprecated.

## Deprecated handling of modified foreign keys in `TableDiff`

Expand Down Expand Up @@ -364,7 +395,7 @@ the `Schema` class itself.

## Deprecated `ForeignKeyConstraint` methods, properties and behavior

The following `ForeignKeyConstraint` methods and property have been deprecated:
The following `ForeignKeyConstraint` methods and properties have been deprecated:

- `ForeignKeyConstraint::getForeignTableName()`, `ForeignKeyConstraint::getQuotedForeignTableName()`,
`ForeignKeyConstraint::getUnqualifiedForeignTableName()`, `ForeignKeyConstraint::$_foreignTableName` – use
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
{"name": "Jonathan Wage", "email": "[email protected]"}
],
"require": {
"php": "^8.1",
"php": "^8.3",
"doctrine/deprecations": "^0.5.3|^1",
"psr/cache": "^1|^2|^3",
"psr/log": "^1|^2|^3"
Expand All @@ -41,9 +41,9 @@
"fig/log-test": "^1",
"jetbrains/phpstorm-stubs": "2023.2",
"phpstan/phpstan": "2.1.1",
"phpstan/phpstan-phpunit": "2.0.3",
"phpstan/phpstan-phpunit": "2.0.6",
"phpstan/phpstan-strict-rules": "^2",
"phpunit/phpunit": "10.5.39",
"phpunit/phpunit": "11.5.15",
"slevomat/coding-standard": "8.13.1",
"squizlabs/php_codesniffer": "3.10.2",
"symfony/cache": "^6.3.8|^7.0",
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<!-- Show progress of the run and show sniff names -->
<arg value="ps"/>

<config name="php_version" value="80100"/>
<config name="php_version" value="80300"/>

<file>src</file>
<file>tests</file>
Expand Down
7 changes: 1 addition & 6 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,12 @@ public function setSchemaManagerFactory(SchemaManagerFactory $schemaManagerFacto
return $this;
}

/** @return true */
public function getDisableTypeComments(): bool
{
return true;
}

/**
* @param true $disableTypeComments
*
* @return $this
*/
/** @return $this */
public function setDisableTypeComments(bool $disableTypeComments): self
{
if (! $disableTypeComments) {
Expand Down
3 changes: 1 addition & 2 deletions src/Driver/PgSQL/Exception/UnexpectedValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
));
}

/** @return null */
public function getSQLState(): string|null
public function getSQLState(): null

Check warning on line 23 in src/Driver/PgSQL/Exception/UnexpectedValue.php

View check run for this annotation

Codecov / codecov/patch

src/Driver/PgSQL/Exception/UnexpectedValue.php#L23

Added line #L23 was not covered by tests
{
return null;
}
Expand Down
9 changes: 9 additions & 0 deletions src/Platforms/AbstractMySQLPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\TransactionIsolationLevel;
use Doctrine\DBAL\Types\Types;
use Doctrine\Deprecations\Deprecation;

use function array_map;
use function array_merge;
Expand Down Expand Up @@ -663,8 +664,16 @@ public function getDefaultTransactionIsolationLevel(): TransactionIsolationLevel
return TransactionIsolationLevel::REPEATABLE_READ;
}

/** @deprecated */
public function supportsColumnLengthIndexes(): bool
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/6886',
'%s is deprecated.',
__METHOD__,
);

return true;
}

Expand Down
10 changes: 10 additions & 0 deletions src/Platforms/AbstractPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
use Doctrine\DBAL\Types\Exception\TypeNotFound;
use Doctrine\DBAL\Types\Exception\TypesException;
use Doctrine\DBAL\Types\Type;
use Doctrine\Deprecations\Deprecation;

use function addcslashes;
use function array_map;
Expand Down Expand Up @@ -1850,9 +1851,18 @@ protected function supportsPartialIndexes(): bool

/**
* Whether the platform supports indexes with column length definitions.
*
* @deprecated
*/
public function supportsColumnLengthIndexes(): bool
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/6886',
'%s is deprecated.',
__METHOD__,
);

return false;
}

Expand Down
5 changes: 1 addition & 4 deletions src/Platforms/SQLitePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
use function strpos;
use function strtolower;
use function substr;
use function trim;

/**
* The SQLitePlatform class describes the specifics and dialects of the SQLite
Expand Down Expand Up @@ -292,9 +291,7 @@ protected function _getCreateTableSQL(OptionallyQualifiedName $tableName, array

$tableComment = '';
if (isset($parameters['comment'])) {
$comment = trim($parameters['comment'], " '");

$tableComment = $this->getInlineTableCommentSQL($comment);
$tableComment = $this->getInlineTableCommentSQL($parameters['comment']);
}

$query = [
Expand Down
17 changes: 17 additions & 0 deletions src/Schema/ComparatorConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
public function __construct(
private readonly bool $detectRenamedColumns = true,
private readonly bool $detectRenamedIndexes = true,
private readonly bool $reportModifiedIndexes = true,
) {
}

Expand All @@ -17,6 +18,7 @@
return new self(
$detectRenamedColumns,
$this->detectRenamedIndexes,
$this->reportModifiedIndexes,
);
}

Expand All @@ -30,11 +32,26 @@
return new self(
$this->detectRenamedColumns,
$detectRenamedIndexes,
$this->reportModifiedIndexes,
);
}

public function getDetectRenamedIndexes(): bool
{
return $this->detectRenamedIndexes;
}

public function withReportModifiedIndexes(bool $reportModifiedIndexes): self
{
return new self(
$this->detectRenamedColumns,
$this->detectRenamedIndexes,
$reportModifiedIndexes,
);
}

public function getReportModifiedIndexes(): bool

Check warning on line 53 in src/Schema/ComparatorConfig.php

View check run for this annotation

Codecov / codecov/patch

src/Schema/ComparatorConfig.php#L53

Added line #L53 was not covered by tests
{
return $this->reportModifiedIndexes;

Check warning on line 55 in src/Schema/ComparatorConfig.php

View check run for this annotation

Codecov / codecov/patch

src/Schema/ComparatorConfig.php#L55

Added line #L55 was not covered by tests
}
}
Loading