Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ jobs:
- "10.0"
- "10.2"
- "10.5"
- "10.7"
extension:
- "mysqli"
- "pdo_mysql"
Expand All @@ -289,6 +290,12 @@ jobs:
- php-version: "8.1"
mariadb-version: "10.5"
extension: "pdo_mysql"
- php-version: "8.1"
mariadb-version: "10.7"
extension: "mysqli"
- php-version: "8.1"
mariadb-version: "10.7"
extension: "pdo_mysql"

services:
mariadb:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,13 @@ public function testColumnCharset(): void
{
$table = new Table('test_column_charset');
$table->addColumn('id', 'integer');
$table->addColumn('no_charset', 'text');
$table->addColumn('foo', 'text')->setPlatformOption('charset', 'ascii');
$table->addColumn('bar', 'text')->setPlatformOption('charset', 'latin1');
$this->schemaManager->dropAndCreateTable($table);

$columns = $this->schemaManager->listTableColumns('test_column_charset');

self::assertFalse($columns['id']->hasPlatformOption('charset'));
self::assertEquals('utf8', $columns['no_charset']->getPlatformOption('charset'));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assertion was removed in #4644 as well. In this test, we don't care what charset the database uses by default.

self::assertEquals('ascii', $columns['foo']->getPlatformOption('charset'));
self::assertEquals('latin1', $columns['bar']->getPlatformOption('charset'));
}
Expand Down Expand Up @@ -280,12 +278,12 @@ public function testColumnCharsetChange(): void
public function testColumnCollation(): void
{
$table = new Table('test_collation');
$table->addOption('collate', $collation = 'latin1_swedish_ci');
$table->addOption('collate', 'latin1_swedish_ci');
$table->addOption('charset', 'latin1');
$table->addColumn('id', 'integer');
$table->addColumn('text', 'text');
$table->addColumn('foo', 'text')->setPlatformOption('collation', 'latin1_swedish_ci');
$table->addColumn('bar', 'text')->setPlatformOption('collation', 'utf8_general_ci');
$table->addColumn('bar', 'text')->setPlatformOption('collation', 'utf8mb4_general_ci');
Copy link
Member Author

@morozov morozov Mar 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the documentation:

MariaDB 10.6, utf8 is an alias for utf8mb3.

In order to test schema introspection, we should use a charset that isn't an alias so that it's introspected as is.

$table->addColumn('baz', 'text')->setPlatformOption('collation', 'binary');
$this->schemaManager->dropAndCreateTable($table);

Expand All @@ -294,7 +292,7 @@ public function testColumnCollation(): void
self::assertArrayNotHasKey('collation', $columns['id']->getPlatformOptions());
self::assertEquals('latin1_swedish_ci', $columns['text']->getPlatformOption('collation'));
self::assertEquals('latin1_swedish_ci', $columns['foo']->getPlatformOption('collation'));
self::assertEquals('utf8_general_ci', $columns['bar']->getPlatformOption('collation'));
self::assertEquals('utf8mb4_general_ci', $columns['bar']->getPlatformOption('collation'));
self::assertInstanceOf(BlobType::class, $columns['baz']->getType());
}

Expand Down Expand Up @@ -525,9 +523,9 @@ public function testEnsureTableOptionsAreReflectedInMetadata(): void
CREATE TABLE test_table_metadata(
col1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY
)
COLLATE utf8_general_ci
COLLATE utf8mb4_general_ci
ENGINE InnoDB
ROW_FORMAT COMPRESSED
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes the following error on MariaDB 10.7:

InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.

When testing schema introspection, we don't care about the specific value of the row format, so we can use any other valid value.

ROW_FORMAT DYNAMIC
COMMENT 'This is a test'
AUTO_INCREMENT=42
PARTITION BY HASH (col1)
Expand All @@ -537,11 +535,11 @@ public function testEnsureTableOptionsAreReflectedInMetadata(): void
$onlineTable = $this->schemaManager->listTableDetails('test_table_metadata');

self::assertEquals('InnoDB', $onlineTable->getOption('engine'));
self::assertEquals('utf8_general_ci', $onlineTable->getOption('collation'));
self::assertEquals('utf8mb4_general_ci', $onlineTable->getOption('collation'));
self::assertEquals(42, $onlineTable->getOption('autoincrement'));
self::assertEquals('This is a test', $onlineTable->getOption('comment'));
self::assertEquals([
'row_format' => 'COMPRESSED',
'row_format' => 'DYNAMIC',
'partitioned' => true,
], $onlineTable->getOption('create_options'));
}
Expand Down