Skip to content

Commit 9ae9a28

Browse files
committed
AC-6921:Fixed Integraion and unit tests related to maridb10.6 support
1 parent 0faffb1 commit 9ae9a28

File tree

11 files changed

+249
-11
lines changed

11 files changed

+249
-11
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
// @codingStandardsIgnoreFile
7+
return [
8+
'auto_increment_test' => 'CREATE TABLE `auto_increment_test` (
9+
`int_auto_increment_with_nullable` int(10) unsigned NOT NULL AUTO_INCREMENT,
10+
`int_disabled_auto_increment` smallint(5) unsigned DEFAULT 0,
11+
UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`)
12+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci',
13+
'reference_table' => 'CREATE TABLE `reference_table` (
14+
`tinyint_ref` tinyint(4) NOT NULL AUTO_INCREMENT,
15+
`tinyint_without_padding` tinyint(4) NOT NULL DEFAULT 0,
16+
`bigint_without_padding` bigint(20) NOT NULL DEFAULT 0,
17+
`smallint_without_padding` smallint(6) NOT NULL DEFAULT 0,
18+
`integer_without_padding` int(11) NOT NULL DEFAULT 0,
19+
`smallint_with_big_padding` smallint(6) NOT NULL DEFAULT 0,
20+
`smallint_without_default` smallint(6) DEFAULT NULL,
21+
`int_without_unsigned` int(11) DEFAULT NULL,
22+
`int_unsigned` int(10) unsigned DEFAULT NULL,
23+
`bigint_default_nullable` bigint(20) unsigned DEFAULT 1,
24+
`bigint_not_default_not_nullable` bigint(20) unsigned NOT NULL,
25+
`smallint_ref` smallint(6) NOT NULL DEFAULT 0,
26+
PRIMARY KEY (`tinyint_ref`,`smallint_ref`),
27+
UNIQUE KEY `REFERENCE_TABLE_SMALLINT_REF` (`smallint_ref`)
28+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci',
29+
'test_table' => 'CREATE TABLE `test_table` (
30+
`smallint` smallint(6) DEFAULT NULL,
31+
`tinyint` tinyint(4) DEFAULT NULL,
32+
`bigint` bigint(20) DEFAULT 0,
33+
`float` float(12,10) DEFAULT 0.0000000000,
34+
`double` double(245,10) DEFAULT 11111111.1111110000,
35+
`decimal` decimal(15,4) DEFAULT 0.0000,
36+
`date` date DEFAULT NULL,
37+
`timestamp` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
38+
`datetime` datetime DEFAULT \'0000-00-00 00:00:00\',
39+
`longtext` longtext DEFAULT NULL,
40+
`mediumtext` mediumtext DEFAULT NULL,
41+
`varchar` varchar(254) DEFAULT NULL,
42+
`char` char(255) DEFAULT NULL,
43+
`mediumblob` mediumblob DEFAULT NULL,
44+
`blob` blob DEFAULT NULL,
45+
`boolean` tinyint(1) DEFAULT NULL,
46+
`integer_main` int(10) unsigned DEFAULT NULL,
47+
`smallint_main` smallint(6) NOT NULL DEFAULT 0,
48+
UNIQUE KEY `TEST_TABLE_SMALLINT_FLOAT` (`smallint`,`float`),
49+
UNIQUE KEY `TEST_TABLE_DOUBLE` (`double`),
50+
KEY `TEST_TABLE_TINYINT_BIGINT` (`tinyint`,`bigint`),
51+
KEY `TEST_TABLE_SMALLINT_MAIN_REFERENCE_TABLE_SMALLINT_REF` (`smallint_main`),
52+
KEY `FK_FB77604C299EB8612D01E4AF8D9931F2` (`integer_main`),
53+
CONSTRAINT `FK_FB77604C299EB8612D01E4AF8D9931F2` FOREIGN KEY (`integer_main`) REFERENCES `auto_increment_test` (`int_auto_increment_with_nullable`) ON DELETE CASCADE,
54+
CONSTRAINT `TEST_TABLE_SMALLINT_MAIN_REFERENCE_TABLE_SMALLINT_REF` FOREIGN KEY (`smallint_main`) REFERENCES `reference_table` (`smallint_ref`) ON DELETE CASCADE,
55+
CONSTRAINT `TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF` FOREIGN KEY (`tinyint`) REFERENCES `reference_table` (`tinyint_ref`) ON DELETE SET NULL
56+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci',
57+
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
// @codingStandardsIgnoreFile
9+
return [
10+
'before' => [
11+
'store' => 'CREATE TABLE `store` (
12+
`store_owner_id` smallint(6) DEFAULT NULL COMMENT \'Store Owner Reference\',
13+
KEY `STORE_STORE_OWNER_ID_STORE_OWNER_OWNER_ID` (`store_owner_id`),
14+
CONSTRAINT `STORE_STORE_OWNER_ID_STORE_OWNER_OWNER_ID` FOREIGN KEY (`store_owner_id`) REFERENCES `store_owner` (`owner_id`) ON DELETE SET NULL
15+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci',
16+
'store_owner' => 'CREATE TABLE `store_owner` (
17+
`owner_id` smallint(6) NOT NULL AUTO_INCREMENT,
18+
`store_owner_name` varchar(255) DEFAULT NULL COMMENT \'Store Owner Name\',
19+
PRIMARY KEY (`owner_id`)
20+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT=\'Store owner information\''
21+
],
22+
'after' => [
23+
'store' => 'CREATE TABLE `store` (
24+
`store_owner` varchar(255) DEFAULT NULL COMMENT \'Store Owner Name\'
25+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci'
26+
]
27+
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
return [
7+
'auto_increment_test' => 'CREATE TABLE `auto_increment_test` (
8+
`int_auto_increment_with_nullable` int(10) unsigned NOT NULL AUTO_INCREMENT,
9+
`int_disabled_auto_increment` smallint(5) unsigned DEFAULT 0,
10+
UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`)
11+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci'
12+
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
return [
9+
'before' => 'CREATE TABLE `some_table` (
10+
`some_column` varchar(255) DEFAULT NULL COMMENT \'Some Column Name\'
11+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci',
12+
'after' => 'CREATE TABLE `some_table_renamed` (
13+
`some_column` varchar(255) DEFAULT NULL COMMENT \'Some Column Name\'
14+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci',
15+
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
// @codingStandardsIgnoreFile
7+
return ['CREATE TABLE `reference_table` (
8+
`tinyint_ref` tinyint NOT NULL AUTO_INCREMENT ,
9+
`tinyint_without_padding` tinyint NOT NULL DEFAULT 0 ,
10+
`bigint_without_padding` bigint NOT NULL DEFAULT 0 ,
11+
`smallint_without_padding` smallint NOT NULL DEFAULT 0 ,
12+
`integer_without_padding` int NOT NULL DEFAULT 0 ,
13+
`smallint_with_big_padding` smallint NOT NULL DEFAULT 0 ,
14+
`smallint_without_default` smallint NULL ,
15+
`int_without_unsigned` int NULL ,
16+
`int_unsigned` int UNSIGNED NULL ,
17+
`bigint_default_nullable` bigint UNSIGNED NULL DEFAULT 1 ,
18+
`bigint_not_default_not_nullable` bigint UNSIGNED NOT NULL ,
19+
CONSTRAINT PRIMARY KEY (`tinyint_ref`)
20+
) ENGINE=innodb DEFAULT CHARSET=utf8mb3 DEFAULT COLLATE=utf8mb3_general_ci
21+
22+
CREATE TABLE `auto_increment_test` (
23+
`int_auto_increment_with_nullable` int UNSIGNED NOT NULL AUTO_INCREMENT ,
24+
`int_disabled_auto_increment` smallint UNSIGNED NULL DEFAULT 0 ,
25+
CONSTRAINT `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` UNIQUE KEY (`int_auto_increment_with_nullable`)
26+
) ENGINE=innodb DEFAULT CHARSET=utf8mb3 DEFAULT COLLATE=utf8mb3_general_ci
27+
28+
CREATE TABLE `test_table` (
29+
`smallint` smallint NOT NULL AUTO_INCREMENT ,
30+
`tinyint` tinyint NULL ,
31+
`bigint` bigint NULL DEFAULT 0 ,
32+
`float` float(12, 4) NULL DEFAULT 0 ,
33+
`double` decimal(14, 6) NULL DEFAULT 11111111.111111 ,
34+
`decimal` decimal(15, 4) NULL DEFAULT 0 ,
35+
`date` date NULL ,
36+
`timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
37+
`datetime` datetime NULL DEFAULT 0 ,
38+
`longtext` longtext NULL ,
39+
`mediumtext` mediumtext NULL ,
40+
`varchar` varchar(254) NULL ,
41+
`char` char(255) NULL ,
42+
`mediumblob` mediumblob NULL ,
43+
`blob` blob NULL ,
44+
`boolean` BOOLEAN NULL ,
45+
CONSTRAINT `TEST_TABLE_SMALLINT_BIGINT` UNIQUE KEY (`smallint`,`bigint`),
46+
CONSTRAINT `TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF` FOREIGN KEY (`tinyint`) REFERENCES `reference_table` (`tinyint_ref`) ON DELETE NO ACTION,
47+
INDEX `TEST_TABLE_TINYINT_BIGINT` (`tinyint`,`bigint`)
48+
) ENGINE=innodb DEFAULT CHARSET=utf8mb3 DEFAULT COLLATE=utf8mb3_general_ci
49+
50+
CREATE TABLE `patch_list` (
51+
`patch_id` int NOT NULL AUTO_INCREMENT COMMENT "Patch Auto Increment",
52+
`patch_name` varchar(1024) NOT NULL COMMENT "Patch Class Name",
53+
CONSTRAINT PRIMARY KEY (`patch_id`)
54+
) ENGINE=innodb DEFAULT CHARSET=utf8mb3 DEFAULT COLLATE=utf8mb3_general_ci COMMENT="List of data/schema patches"
55+
56+
'];
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
return [
7+
'test_table_one' => 'CREATE TABLE `test_table_one` (
8+
`smallint` smallint(6) NOT NULL AUTO_INCREMENT,
9+
`varchar` varchar(254) DEFAULT NULL,
10+
PRIMARY KEY (`smallint`)
11+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci',
12+
'test_table_two' => 'CREATE TABLE `test_table_two` (
13+
`smallint` smallint(6) NOT NULL AUTO_INCREMENT,
14+
`varchar` varchar(254) DEFAULT NULL,
15+
PRIMARY KEY (`smallint`)
16+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci',
17+
'reference_table' => 'CREATE TABLE `reference_table` (
18+
`tinyint_ref` tinyint(4) NOT NULL AUTO_INCREMENT,
19+
`tinyint_without_padding` tinyint(4) NOT NULL DEFAULT 0,
20+
`bigint_without_padding` bigint(20) NOT NULL DEFAULT 0,
21+
`smallint_without_padding` smallint(6) NOT NULL DEFAULT 0,
22+
`integer_without_padding` int(11) NOT NULL DEFAULT 0,
23+
`smallint_with_big_padding` smallint(6) NOT NULL DEFAULT 0,
24+
`smallint_without_default` smallint(6) DEFAULT NULL,
25+
`int_without_unsigned` int(11) DEFAULT NULL,
26+
`int_unsigned` int(10) unsigned DEFAULT NULL,
27+
`bigint_default_nullable` bigint(20) unsigned DEFAULT 1,
28+
`bigint_not_default_not_nullable` bigint(20) unsigned NOT NULL,
29+
PRIMARY KEY (`tinyint_ref`)
30+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci',
31+
'auto_increment_test' => 'CREATE TABLE `auto_increment_test` (
32+
`int_auto_increment_with_nullable` int(10) unsigned NOT NULL AUTO_INCREMENT,
33+
`int_disabled_auto_increment` smallint(5) unsigned DEFAULT 0,
34+
UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`)
35+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci'
36+
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
return [
9+
'auto_increment_test' => 'CREATE TABLE `auto_increment_test` (
10+
`int_auto_increment_with_nullable` int(10) unsigned NOT NULL AUTO_INCREMENT,
11+
`int_disabled_auto_increment` smallint(5) unsigned DEFAULT 0,
12+
UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`)
13+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci'
14+
];

dev/tests/setup-integration/framework/Magento/TestFramework/Annotation/DataProviderFromFile.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ class DataProviderFromFile
2020
/**
2121
* @var string
2222
*/
23-
const FALLBACK_VALUE = 'default';
23+
public const FALLBACK_VALUE = 'default';
2424

2525
/**
2626
* @var array
2727
*/
28-
const POSSIBLE_SUFFIXES = [
28+
public const POSSIBLE_SUFFIXES = [
2929
SqlVersionProvider::MYSQL_8_0_VERSION => 'mysql8',
30-
SqlVersionProvider::MARIA_DB_10_VERSION => 'mariadb10',
30+
SqlVersionProvider::MARIA_DB_10_4_VERSION => 'mariadb10',
31+
SqlVersionProvider::MARIA_DB_10_6_VERSION => 'mariadb106',
3132
];
3233

3334
/**

lib/internal/Magento/Framework/DB/Adapter/SqlVersionProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ class SqlVersionProvider
2525

2626
public const MARIA_DB_10_VERSION = '10.';
2727

28+
public const MARIA_DB_10_4_VERSION = '10.4.';
29+
30+
public const MARIA_DB_10_6_VERSION = '10.6.';
31+
2832
/**#@-*/
2933

3034
/**

lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Table.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
namespace Magento\Framework\Setup\Declaration\Schema\Dto\Factories;
88

99
use Magento\Framework\App\ResourceConnection;
10-
use Magento\Framework\ObjectManagerInterface;
1110
use Magento\Framework\DB\Adapter\SqlVersionProvider;
11+
use Magento\Framework\ObjectManagerInterface;
1212

1313
/**
1414
* Table DTO element factory.
@@ -43,17 +43,17 @@ class Table implements FactoryInterface
4343
* @var array|string[]
4444
*/
4545
private static array $defaultCharset = [
46-
'10.4' => 'utf8',
47-
'10.6' => 'utf8mb3',
46+
'10.4.' => 'utf8',
47+
'10.6.' => 'utf8mb3',
4848
'default' => 'utf8',
4949
];
5050

5151
/**
5252
* @var array|string[]
5353
*/
5454
private static array $defaultCollation = [
55-
'10.4' => 'utf8_general_ci',
56-
'10.6' => 'utf8mb3_general_ci',
55+
'10.4.' => 'utf8_general_ci',
56+
'10.6.' => 'utf8mb3_general_ci',
5757
'default' => 'utf8_general_ci',
5858
];
5959

@@ -63,12 +63,13 @@ class Table implements FactoryInterface
6363
* @param ObjectManagerInterface $objectManager
6464
* @param ResourceConnection $resourceConnection
6565
* @param string $className
66+
* @param SqlVersionProvider|null $sqlVersionProvider
6667
*/
6768
public function __construct(
6869
ObjectManagerInterface $objectManager,
6970
ResourceConnection $resourceConnection,
70-
$className = \Magento\Framework\Setup\Declaration\Schema\Dto\Table::class,
71-
$sqlVersionProvider = null
71+
string $className = \Magento\Framework\Setup\Declaration\Schema\Dto\Table::class,
72+
?SqlVersionProvider $sqlVersionProvider = null
7273
) {
7374
$this->objectManager = $objectManager;
7475
$this->className = $className;
@@ -110,6 +111,8 @@ public function create(array $data)
110111
}
111112

112113
/**
114+
* Get default charset based on sql version
115+
*
113116
* @return string
114117
*/
115118
private function getDefaultCharset(): string
@@ -118,6 +121,8 @@ private function getDefaultCharset(): string
118121
}
119122

120123
/**
124+
* Get default collation based on sql version
125+
*
121126
* @return string
122127
*/
123128
private function getDefaultCollation(): string

0 commit comments

Comments
 (0)