diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml
index 6225237cff1..616ca0c795c 100644
--- a/.github/workflows/continuous-integration.yml
+++ b/.github/workflows/continuous-integration.yml
@@ -277,8 +277,7 @@ jobs:
php-version:
- "8.1"
mariadb-version:
- - "10.2" # Oldest version supported by DBAL
- - "10.4" # LTS (Jun 2024)
+ - "10.4" # Oldest version supported by DBAL, LTS (Jun 2024)
- "10.5" # LTS (Jun 2025)
- "10.6" # LTS (Jul 2026)
- "10.9" # STS (Aug 2023)
diff --git a/UPGRADE.md b/UPGRADE.md
index 1e53bde0f59..2ea323e3891 100644
--- a/UPGRADE.md
+++ b/UPGRADE.md
@@ -400,11 +400,12 @@ The `Doctrine\DBAL\Schema\Visitor\Graphviz` class has been removed.
Oracle 12c (12.2.0.1) and older are not supported anymore.
-## BC BREAK: Removed support for MariaDB 10.2.6 and older
+## BC BREAK: Removed support for MariaDB 10.4.2 and older
-MariaDB 10.2.6 and older are not supported anymore. The following classes have been removed:
+MariaDB 10.4.2 and older are not supported anymore. The following classes have been removed:
* `Doctrine\DBAL\Platforms\MariaDb1027Platform`
+* `Doctrine\DBAL\Platforms\MariaDB1043Platform`
* `Doctrine\DBAL\Platforms\Keywords\MariaDb102Keywords`
## BC BREAK: Removed support for MySQL 5.6 and older
diff --git a/docs/en/reference/platforms.rst b/docs/en/reference/platforms.rst
index b7d3bc7a0a3..1cc1f6dfee4 100644
--- a/docs/en/reference/platforms.rst
+++ b/docs/en/reference/platforms.rst
@@ -39,7 +39,8 @@ MySQL
MariaDB
^^^^^
-- ``MariaDBPlatform`` for version 10.2 (10.2.7 GA) and above.
+- ``MariaDBPlatform`` for version 10.4 (10.4.3 GA) and above.
+- ``MariaDB1052Platform`` for version 10.5 (10.5.2 GA) and above.
Oracle
^^^^^^
diff --git a/psalm.xml.dist b/psalm.xml.dist
index e0fe6953c6c..b8299e81ca1 100644
--- a/psalm.xml.dist
+++ b/psalm.xml.dist
@@ -42,11 +42,6 @@
-
-
-
-
-
diff --git a/src/Driver/AbstractMySQLDriver.php b/src/Driver/AbstractMySQLDriver.php
index c48937c00d1..ce58f9aa36b 100644
--- a/src/Driver/AbstractMySQLDriver.php
+++ b/src/Driver/AbstractMySQLDriver.php
@@ -8,7 +8,6 @@
use Doctrine\DBAL\Driver\API\MySQL\ExceptionConverter;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Platforms\Exception\InvalidPlatformVersion;
-use Doctrine\DBAL\Platforms\MariaDB1043Platform;
use Doctrine\DBAL\Platforms\MariaDB1052Platform;
use Doctrine\DBAL\Platforms\MariaDBPlatform;
use Doctrine\DBAL\Platforms\MySQL80Platform;
@@ -38,10 +37,6 @@ public function getDatabasePlatform(ServerVersionProvider $versionProvider): Abs
return new MariaDB1052Platform();
}
- if (version_compare($mariaDbVersion, '10.4.3', '>=')) {
- return new MariaDB1043Platform();
- }
-
return new MariaDBPlatform();
}
diff --git a/src/Platforms/MariaDB1043Platform.php b/src/Platforms/MariaDB1043Platform.php
deleted file mode 100644
index 428de788f4c..00000000000
--- a/src/Platforms/MariaDB1043Platform.php
+++ /dev/null
@@ -1,80 +0,0 @@
-getJsonTypeDeclarationSQL([]) !== 'JSON') {
- return parent::getColumnTypeSQLSnippets($tableAlias);
- }
-
- $columnTypeSQL = <<getJsonTypeDeclarationSQL([]) === 'JSON' && ($column['type'] ?? null) instanceof JsonType) {
- unset($column['collation']);
- unset($column['charset']);
- }
-
- return parent::getColumnDeclarationSQL($name, $column);
- }
-}
diff --git a/src/Platforms/MariaDB1052Platform.php b/src/Platforms/MariaDB1052Platform.php
index 47abe122ead..2489637566d 100644
--- a/src/Platforms/MariaDB1052Platform.php
+++ b/src/Platforms/MariaDB1052Platform.php
@@ -12,7 +12,7 @@
*
* Note: Should not be used with versions prior to 10.5.2.
*/
-class MariaDB1052Platform extends MariaDB1043Platform
+class MariaDB1052Platform extends MariaDBPlatform
{
/**
* {@inheritDoc}
diff --git a/src/Platforms/MariaDBPlatform.php b/src/Platforms/MariaDBPlatform.php
index 2c5b092171d..570d0e360db 100644
--- a/src/Platforms/MariaDBPlatform.php
+++ b/src/Platforms/MariaDBPlatform.php
@@ -8,6 +8,7 @@
use Doctrine\DBAL\Platforms\Keywords\MariaDBKeywords;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\TableDiff;
+use Doctrine\DBAL\Types\JsonType;
use function array_diff_key;
use function array_merge;
@@ -20,13 +21,53 @@
class MariaDBPlatform extends AbstractMySQLPlatform
{
/**
- * {@inheritDoc}
+ * Use JSON rather than LONGTEXT for json columns. Since it is not a true native type, do not override
+ * hasNativeJsonType() so the DC2Type comment will still be set.
*
* @link https://mariadb.com/kb/en/library/json-data-type/
+ *
+ * {@inheritDoc}
*/
public function getJsonTypeDeclarationSQL(array $column): string
{
- return 'LONGTEXT';
+ return 'JSON';
+ }
+
+ /**
+ * Generate SQL snippets to reverse the aliasing of JSON to LONGTEXT.
+ *
+ * MariaDb aliases columns specified as JSON to LONGTEXT and sets a CHECK constraint to ensure the column
+ * is valid json. This function generates the SQL snippets which reverse this aliasing i.e. report a column
+ * as JSON where it was originally specified as such instead of LONGTEXT.
+ *
+ * The CHECK constraints are stored in information_schema.CHECK_CONSTRAINTS so JOIN that table.
+ *
+ * @return array{string, string}
+ */
+ public function getColumnTypeSQLSnippets(string $tableAlias = 'c'): array
+ {
+ if ($this->getJsonTypeDeclarationSQL([]) !== 'JSON') {
+ return parent::getColumnTypeSQLSnippets($tableAlias);
+ }
+
+ $columnTypeSQL = <<getJsonTypeDeclarationSQL([]) === 'JSON' && ($column['type'] ?? null) instanceof JsonType) {
+ unset($column['collation']);
+ unset($column['charset']);
+ }
+
+ return parent::getColumnDeclarationSQL($name, $column);
+ }
+
protected function createReservedKeywordsList(): KeywordList
{
return new MariaDBKeywords();
diff --git a/tests/Functional/Schema/MySQL/ComparatorTest.php b/tests/Functional/Schema/MySQL/ComparatorTest.php
index 95939630c3c..e621ba0aafc 100644
--- a/tests/Functional/Schema/MySQL/ComparatorTest.php
+++ b/tests/Functional/Schema/MySQL/ComparatorTest.php
@@ -7,7 +7,7 @@
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Platforms\AbstractPlatform;
-use Doctrine\DBAL\Platforms\MariaDB1043Platform;
+use Doctrine\DBAL\Platforms\MariaDBPlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\Comparator;
@@ -177,7 +177,7 @@ public static function tableAndColumnOptionsProvider(): iterable
public function testMariaDb1043NativeJsonUpgradeDetected(): void
{
- if (! $this->platform instanceof MariaDB1043Platform) {
+ if (! $this->platform instanceof MariaDBPlatform) {
self::markTestSkipped();
}
diff --git a/tests/Functional/Schema/MySQL/JsonCollationTest.php b/tests/Functional/Schema/MySQL/JsonCollationTest.php
index c9d8d9188b6..2bf25eea0dc 100644
--- a/tests/Functional/Schema/MySQL/JsonCollationTest.php
+++ b/tests/Functional/Schema/MySQL/JsonCollationTest.php
@@ -5,7 +5,7 @@
namespace Doctrine\DBAL\Tests\Functional\Schema\MySQL;
use Doctrine\DBAL\Platforms\AbstractPlatform;
-use Doctrine\DBAL\Platforms\MariaDB1043Platform;
+use Doctrine\DBAL\Platforms\MariaDBPlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Schema\Table;
@@ -31,7 +31,7 @@ protected function setUp(): void
{
$this->platform = $this->connection->getDatabasePlatform();
- if (! $this->platform instanceof MariaDB1043Platform) {
+ if (! $this->platform instanceof MariaDBPlatform) {
self::markTestSkipped();
}
diff --git a/tests/Platforms/MariaDB1043PlatformTest.php b/tests/Platforms/MariaDB1043PlatformTest.php
deleted file mode 100644
index 81320272f60..00000000000
--- a/tests/Platforms/MariaDB1043PlatformTest.php
+++ /dev/null
@@ -1,39 +0,0 @@
-platform->getJsonTypeDeclarationSQL([]));
- }
-
- public function testInitializesJsonTypeMapping(): void
- {
- self::assertTrue($this->platform->hasDoctrineTypeMappingFor('json'));
- self::assertSame(Types::JSON, $this->platform->getDoctrineTypeMapping('json'));
- }
-
- public function testIgnoresDifferenceInDefaultValuesForUnsupportedColumnTypes(): void
- {
- self::markTestSkipped('MariaDb1043Platform supports default values for BLOB and TEXT columns');
- }
-}
diff --git a/tests/Platforms/MariaDB1052PlatformTest.php b/tests/Platforms/MariaDB1052PlatformTest.php
index 0e9f10dab19..2fd0d73a90c 100644
--- a/tests/Platforms/MariaDB1052PlatformTest.php
+++ b/tests/Platforms/MariaDB1052PlatformTest.php
@@ -7,7 +7,7 @@
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\MariaDB1052Platform;
-class MariaDB1052PlatformTest extends MariaDB1043PlatformTest
+class MariaDB1052PlatformTest extends MariaDBPlatformTest
{
public function createPlatform(): AbstractPlatform
{
diff --git a/tests/Platforms/MariaDBPlatformTest.php b/tests/Platforms/MariaDBPlatformTest.php
index 1df589c14cc..de46ba2bacc 100644
--- a/tests/Platforms/MariaDBPlatformTest.php
+++ b/tests/Platforms/MariaDBPlatformTest.php
@@ -16,13 +16,14 @@ public function createPlatform(): AbstractPlatform
}
/**
- * From MariaDB 10.2.7, JSON type is an alias to LONGTEXT
+ * From MariaDB 10.2.7, JSON type is an alias to LONGTEXT however from 10.4.3 setting a column
+ * as JSON adds additional functionality so use JSON.
*
* @link https://mariadb.com/kb/en/library/json-data-type/
*/
public function testReturnsJsonTypeDeclarationSQL(): void
{
- self::assertSame('LONGTEXT', $this->platform->getJsonTypeDeclarationSQL([]));
+ self::assertSame('JSON', $this->platform->getJsonTypeDeclarationSQL([]));
}
public function testInitializesJsonTypeMapping(): void
diff --git a/tests/Platforms/MySQL/MariaDBJsonComparatorTest.php b/tests/Platforms/MySQL/MariaDBJsonComparatorTest.php
index d9271beaea4..274edf99492 100644
--- a/tests/Platforms/MySQL/MariaDBJsonComparatorTest.php
+++ b/tests/Platforms/MySQL/MariaDBJsonComparatorTest.php
@@ -4,7 +4,7 @@
namespace Doctrine\DBAL\Tests\Platforms\MySQL;
-use Doctrine\DBAL\Platforms\MariaDB1043Platform;
+use Doctrine\DBAL\Platforms\MariaDBPlatform;
use Doctrine\DBAL\Platforms\MySQL\CharsetMetadataProvider;
use Doctrine\DBAL\Platforms\MySQL\CollationMetadataProvider;
use Doctrine\DBAL\Platforms\MySQL\Comparator;
@@ -25,7 +25,7 @@ class MariaDBJsonComparatorTest extends TestCase
protected function setUp(): void
{
$this->comparator = new Comparator(
- new MariaDB1043Platform(),
+ new MariaDBPlatform(),
new class implements CharsetMetadataProvider {
public function getDefaultCharsetCollation(string $charset): ?string
{