Skip to content

Commit

Permalink
Merge branch 4.1.x into feature/rename-columns-configurable
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Schema/Comparator.php
  • Loading branch information
ausi committed Aug 15, 2024
2 parents b4195ae + 2377cd4 commit c3afa66
Show file tree
Hide file tree
Showing 54 changed files with 1,181 additions and 417 deletions.
14 changes: 10 additions & 4 deletions .doctrine-project.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,35 @@
"slug": "latest",
"upcoming": true
},
{
"name": "4.2",
"branchName": "4.2.x",
"slug": "4.2",
"upcoming": true
},
{
"name": "4.1",
"branchName": "4.1.x",
"slug": "4.1",
"upcoming": true
"current": true
},
{
"name": "4.0",
"branchName": "4.0.x",
"slug": "4.0",
"current": true
"maintained": false
},
{
"name": "3.9",
"branchName": "3.9.x",
"slug": "3.9",
"upcoming": true
"maintained": true
},
{
"name": "3.8",
"branchName": "3.8.x",
"slug": "3.8",
"maintained": true
"maintained": false
},
{
"name": "3.7",
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,11 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.3"
mysql-version:
- "5.7"
- "8.0"
- "9.0"
extension:
- "mysqli"
- "pdo_mysql"
Expand All @@ -363,18 +364,19 @@ jobs:
php-version: "8.1"
mysql-version: "8.0"
extension: "mysqli"
- php-version: "8.2"
- php-version: "8.1"
mysql-version: "8.0"
extension: "mysqli"
- php-version: "8.3"
- php-version: "8.1"
mysql-version: "8.0"
extension: "pdo_mysql"
- php-version: "8.1"
# Workaround for https://bugs.mysql.com/114876
- php-version: "8.3"
mysql-version: "8.4"
extension: "mysqli"
custom-entrypoint: >-
--entrypoint sh mysql:8.4 -c "exec docker-entrypoint.sh mysqld --mysql-native-password=ON"
- php-version: "8.1"
- php-version: "8.3"
mysql-version: "8.4"
extension: "pdo_mysql"
custom-entrypoint: >-
Expand Down Expand Up @@ -458,7 +460,7 @@ jobs:
MSSQL_COLLATION: "${{ matrix.collation }}"

options: >-
--health-cmd "echo quit | /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -l 1 -U sa -P Doctrine2018"
--health-cmd "echo quit | /opt/mssql-tools18/bin/sqlcmd -C -S 127.0.0.1 -l 1 -U sa -P Doctrine2018"
ports:
- "1433:1433"
Expand Down
72 changes: 72 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: "Continuous Integration (Nightly)"

on:
schedule:
- cron: "12 3 * * *"
workflow_dispatch:

env:
fail-fast: true

jobs:
phpunit-mariadb:
name: "PHPUnit with MariaDB"
runs-on: "ubuntu-24.04"

strategy:
matrix:
php-version:
- "8.3"
mariadb-version:
- "earliest"
- "verylatest"
extension:
- "mysqli"
- "pdo_mysql"

services:
mariadb:
image: "quay.io/mariadb-foundation/mariadb-devel:${{ matrix.mariadb-version }}"
env:
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: yes
MARIADB_DATABASE: "doctrine_tests"

options: >-
--health-cmd "healthcheck.sh --connect --innodb_initialized"
ports:
- "3306:3306"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 2

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "pcov"
ini-values: "zend.assertions=1"
extensions: "${{ matrix.extension }}"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v3"
with:
composer-options: "--ignore-platform-req=php+"

- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml"

- name: Tell the MariaDB Folks if it failed
if: ${{ failure() }}
uses: zulip/github-actions-zulip/send-message@v1
with:
api-key: ${{ secrets.MARIADB_ZULIP_API_KEY }}
email: "doctrine-bot@mariadb.zulipchat.com"
organization-url: "https://mariadb.zulipchat.com"
to: "Buildbot"
type: "stream"
topic: "CI - Doctrine/DBAL"
content: "There was an error running Doctrine on MariaDB:${{ matrix.mariadb-version }} - URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}."
36 changes: 14 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Doctrine DBAL

| [5.0-dev][5.0] | [4.1-dev][4.1] | [4.0][4.0] | [3.9-dev][3.9] | [3.8][3.8] |
|:---------------------------------------------------:|:---------------------------------------------------:|:---------------------------------------------------:|:---------------------------------------------------:|:---------------------------------------------------:|
| [![GitHub Actions][GA 5.0 image]][GA 5.0] | [![GitHub Actions][GA 4.1 image]][GA 4.1] | [![GitHub Actions][GA 4.0 image]][GA 4.0] | [![GitHub Actions][GA 3.9 image]][GA 3.9] | [![GitHub Actions][GA 3.8 image]][GA 3.8] |
| [![AppVeyor][AppVeyor 5.0 image]][AppVeyor 5.0] | [![AppVeyor][AppVeyor 4.1 image]][AppVeyor 4.1] | [![AppVeyor][AppVeyor 4.0 image]][AppVeyor 4.0] | [![AppVeyor][AppVeyor 3.9 image]][AppVeyor 3.9] | [![AppVeyor][AppVeyor 3.8 image]][AppVeyor 3.8] |
| [![Code Coverage][Coverage 5.0 image]][CodeCov 5.0] | [![Code Coverage][Coverage 4.1 image]][CodeCov 4.1] | [![Code Coverage][Coverage 4.0 image]][CodeCov 4.0] | [![Code Coverage][Coverage 3.9 image]][CodeCov 3.9] | [![Code Coverage][Coverage 3.8 image]][CodeCov 3.8] |
| N/A | N/A | [![Type Coverage][TypeCov image]][TypeCov] | N/A | |
| [5.0-dev][5.0] | [4.2-dev][4.2] | [4.1][4.1] | [3.9][3.9] |
|:---------------------------------------------------:|:---------------------------------------------------:|:---------------------------------------------------:|:---------------------------------------------------:|
| [![GitHub Actions][GA 5.0 image]][GA 5.0] | [![GitHub Actions][GA 4.2 image]][GA 4.2] | [![GitHub Actions][GA 4.1 image]][GA 4.1] | [![GitHub Actions][GA 3.9 image]][GA 3.9] |
| [![AppVeyor][AppVeyor 5.0 image]][AppVeyor 5.0] | [![AppVeyor][AppVeyor 4.2 image]][AppVeyor 4.2] | [![AppVeyor][AppVeyor 4.1 image]][AppVeyor 4.1] | [![AppVeyor][AppVeyor 3.9 image]][AppVeyor 3.9] |
| [![Code Coverage][Coverage 5.0 image]][CodeCov 5.0] | [![Code Coverage][Coverage 4.2 image]][CodeCov 4.2] | [![Code Coverage][Coverage 4.1 image]][CodeCov 4.1] | [![Code Coverage][Coverage 3.9 image]][CodeCov 3.9] |
| N/A | N/A | [![Type Coverage][TypeCov image]][TypeCov] | N/A |

Powerful ***D***ata***B***ase ***A***bstraction ***L***ayer with many features for database schema introspection and schema management.

Expand All @@ -23,21 +23,21 @@ Powerful ***D***ata***B***ase ***A***bstraction ***L***ayer with many features f
[GA 5.0]: https://github.com/doctrine/dbal/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A5.0.x
[GA 5.0 image]: https://github.com/doctrine/dbal/workflows/Continuous%20Integration/badge.svg?branch=5.0.x

[Coverage 4.2 image]: https://codecov.io/gh/doctrine/dbal/branch/4.2.x/graph/badge.svg
[4.2]: https://github.com/doctrine/dbal/tree/4.2.x
[CodeCov 4.2]: https://codecov.io/gh/doctrine/dbal/branch/4.2.x
[AppVeyor 4.2]: https://ci.appveyor.com/project/doctrine/dbal/branch/4.2.x
[AppVeyor 4.2 image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/4.2.x?svg=true
[GA 4.2]: https://github.com/doctrine/dbal/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A4.2.x
[GA 4.2 image]: https://github.com/doctrine/dbal/workflows/Continuous%20Integration/badge.svg?branch=4.2.x

[Coverage 4.1 image]: https://codecov.io/gh/doctrine/dbal/branch/4.1.x/graph/badge.svg
[4.1]: https://github.com/doctrine/dbal/tree/4.1.x
[CodeCov 4.1]: https://codecov.io/gh/doctrine/dbal/branch/4.1.x
[AppVeyor 4.1]: https://ci.appveyor.com/project/doctrine/dbal/branch/4.1.x
[AppVeyor 4.1 image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/4.1.x?svg=true
[GA 4.1]: https://github.com/doctrine/dbal/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A4.1.x
[GA 4.1 image]: https://github.com/doctrine/dbal/workflows/Continuous%20Integration/badge.svg?branch=4.1.x

[Coverage 4.0 image]: https://codecov.io/gh/doctrine/dbal/branch/4.0.x/graph/badge.svg
[4.0]: https://github.com/doctrine/dbal/tree/4.0.x
[CodeCov 4.0]: https://codecov.io/gh/doctrine/dbal/branch/4.0.x
[AppVeyor 4.0]: https://ci.appveyor.com/project/doctrine/dbal/branch/4.0.x
[AppVeyor 4.0 image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/4.0.x?svg=true
[GA 4.0]: https://github.com/doctrine/dbal/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A4.0.x
[GA 4.0 image]: https://github.com/doctrine/dbal/workflows/Continuous%20Integration/badge.svg?branch=4.0.x
[TypeCov]: https://shepherd.dev/github/doctrine/dbal
[TypeCov image]: https://shepherd.dev/github/doctrine/dbal/coverage.svg

Expand All @@ -48,11 +48,3 @@ Powerful ***D***ata***B***ase ***A***bstraction ***L***ayer with many features f
[AppVeyor 3.9 image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/3.9.x?svg=true
[GA 3.9]: https://github.com/doctrine/dbal/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A3.9.x
[GA 3.9 image]: https://github.com/doctrine/dbal/workflows/Continuous%20Integration/badge.svg?branch=3.9.x

[Coverage 3.8 image]: https://codecov.io/gh/doctrine/dbal/branch/3.8.x/graph/badge.svg
[3.8]: https://github.com/doctrine/dbal/tree/3.8.x
[CodeCov 3.8]: https://codecov.io/gh/doctrine/dbal/branch/3.8.x
[AppVeyor 3.8]: https://ci.appveyor.com/project/doctrine/dbal/branch/3.8.x
[AppVeyor 3.8 image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/3.8.x?svg=true
[GA 3.8]: https://github.com/doctrine/dbal/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A3.8.x
[GA 3.8 image]: https://github.com/doctrine/dbal/workflows/Continuous%20Integration/badge.svg?branch=3.8.x
8 changes: 7 additions & 1 deletion UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@ awareness about deprecated code.

# Upgrade to 4.1

## Deprecated support for MariaDB 10.4 and MySQL 5.7
## Deprecated `TableDiff` methods

The `TableDiff` methods `getModifiedColumns()` and `getRenamedColumns()` have been merged into a single
method `getChangedColumns()`. Use this method instead.

## Deprecated support for MariaDB 10.4, MySQL 5.7 and Postgres 10 + 11

* Upgrade to MariaDB 10.5 or later.
* Upgrade to MySQL 8.0 or later.
* Upgrade to Postgres 12 or later.

## Add `Result::getColumnName()`

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
"doctrine/coding-standard": "12.0.0",
"fig/log-test": "^1",
"jetbrains/phpstorm-stubs": "2023.2",
"phpstan/phpstan": "1.11.5",
"phpstan/phpstan": "1.11.7",
"phpstan/phpstan-phpunit": "1.4.0",
"phpstan/phpstan-strict-rules": "^1.6",
"phpunit/phpunit": "10.5.22",
"phpunit/phpunit": "10.5.28",
"psalm/plugin-phpunit": "0.19.0",
"slevomat/coding-standard": "8.13.1",
"squizlabs/php_codesniffer": "3.10.1",
"squizlabs/php_codesniffer": "3.10.2",
"symfony/cache": "^6.3.8|^7.0",
"symfony/console": "^5.4|^6.3|^7.0",
"vimeo/psalm": "5.24.0"
Expand Down
38 changes: 26 additions & 12 deletions docs/en/reference/platforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ Microsoft SQL Server
PostgreSQL
^^^^^^^^^^

- ``PostgreSQLPlatform`` for version 9.4 and above.
- ``PostgreSQL100Platform`` for version 10.0 and above.
- ``PostgreSQLPlatform`` for version 10.0 and above.
- ``PostgreSQL120Platform`` for version 12.0 and above.

IBM DB2
^^^^^^^
Expand All @@ -76,20 +76,34 @@ database vendor and version best. Otherwise it is not guaranteed
that the compatibility in terms of SQL dialect and feature support
between Doctrine DBAL and the database server will always be given.

If you want to overwrite parts of your platform you can do so when
creating a connection. There is a ``platform`` option you can pass
an instance of the platform you want the connection to use:
If you want to overwrite parts of your platform you can do so by
using a middleware:

::

<?php
$myPlatform = new MyPlatform();
$options = [
'driver' => 'pdo_sqlite',
'path' => 'database.sqlite',
'platform' => $myPlatform,
];
$conn = DriverManager::getConnection($options);
class CustomSQLitePlatform extends SqlitePlatform {}

class CustomDriver extends AbstractDriverMiddleware
{
public function getDatabasePlatform(ServerVersionProvider $versionProvider)
{
return new CustomSQLitePlatform();
}
}

class CustomMiddleware implements Driver\Middleware
{
public function wrap(Driver $driver): Driver
{
return new CustomDriver($driver);
}
}

$config = new Doctrine\DBAL\Configuration();
$config->setMiddlewares([new CustomMiddleware()]);

$connection = DriverManager::getConnection($params, $config);

This way you can optimize your schema or generated SQL code with
features that might not be portable for instance, however are
Expand Down
2 changes: 1 addition & 1 deletion docs/en/reference/query-builder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ user-input:
<?php
$queryBuilder
->update('users', 'u')
->update('users u')
->set('u.logins', 'u.logins + 1')
->set('u.last_login', '?')
->setParameter(0, $userInputLastLogin)
Expand Down
26 changes: 22 additions & 4 deletions docs/en/reference/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,21 @@ or ``null`` if no data is present.
it approximates precision which can lead to false assumptions in
applications.

smallfloat
++++++++++

Maps and converts single precision floating-point values.
This type is suitable for storing numeric data with approximate precision, where 4-byte (32-bit) storage is sufficient.
Single precision values typically have a wide range, accommodating most numerical requirements with a precision of up to 7 decimal digits.
Values retrieved from the database are always converted to PHP's ``float``/``double`` type or ``null`` if no data is present.

float
+++++

Maps and converts numeric data with floating-point precision.
If you only need an approximate precision for numbers with fractions, you should
consider using this type.
Values retrieved from the database are always converted to PHP's
Maps and converts double precision floating-point values.
This type is suitable for storing numeric data with higher precision, requiring 8-byte (64-bit) storage.
Double precision values typically offer an extensive range, meeting the demands of more precise calculations
with a precision of up to 15 decimal digits. Values retrieved from the database are always converted to PHP's
``float``/``double`` type or ``null`` if no data is present.

String types
Expand Down Expand Up @@ -572,6 +580,16 @@ Please also notice the mapping specific footnotes for additional information.
| | +--------------------------+ | |
| | | **SQLite** | | |
+-------------------+---------------+--------------------------+---------+----------------------------------------------------------+
| **smallfloat** | ``float`` | **MySQL** | *all* | ``FLOAT`` ``UNSIGNED`` [10] |
| | +--------------------------+---------+----------------------------------------------------------+
| | | **PostgreSQL** | *all* | ``REAL`` |
| | +--------------------------+ | |
| | | **Oracle** | | |
| | +--------------------------+ | |
| | | **SQL Server** | | |
| | +--------------------------+ | |
| | | **SQLite** | | |
+-------------------+---------------+--------------------------+---------+----------------------------------------------------------+
| **float** | ``float`` | **MySQL** | *all* | ``DOUBLE PRECISION`` ``UNSIGNED`` [10] |
| | +--------------------------+---------+----------------------------------------------------------+
| | | **PostgreSQL** | *all* | ``DOUBLE PRECISION`` |
Expand Down
3 changes: 3 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<referencedClass name="Doctrine\DBAL\Platforms\Keywords\MySQL80Keywords" />
<referencedClass name="Doctrine\DBAL\Platforms\MariaDB1052Platform" />
<referencedClass name="Doctrine\DBAL\Platforms\MySQL80Platform" />
<referencedClass name="Doctrine\DBAL\Platforms\PostgreSQL120Platform" />
</errorLevel>
</DeprecatedClass>
<DeprecatedMethod>
Expand All @@ -59,6 +60,8 @@
See https://github.com/doctrine/dbal/pull/6202
TODO: remove in 4.0.0
-->
<referencedMethod name="Doctrine\DBAL\Schema\TableDiff::getModifiedColumns" />
<referencedMethod name="Doctrine\DBAL\Schema\TableDiff::getRenamedColumns" />
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractMySQLPlatform::getColumnTypeSQLSnippets" />
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractMySQLPlatform::getDatabaseNameSQL" />

Expand Down
3 changes: 2 additions & 1 deletion src/Driver/API/MySQL/ExceptionConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public function convert(Exception $exception, ?Query $query): DriverException
2002,
2005,
2054 => new ConnectionException($exception, $query),
2006 => new ConnectionLost($exception, $query),
2006,
4031 => new ConnectionLost($exception, $query),
1048,
1121,
1138,
Expand Down
Loading

0 comments on commit c3afa66

Please sign in to comment.