Unverified Commit bbd004c1 authored by Sergei Morozov's avatar Sergei Morozov

Merge branch 'bpo/2.9/#3420' into 2.9

parents f1926101 5fe8b795
......@@ -68,7 +68,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
} elseif (strpos($v['index_type'], 'SPATIAL') !== false) {
$v['flags'] = ['SPATIAL'];
}
$v['length'] = $v['sub_part'] ?? null;
$v['length'] = isset($v['sub_part']) ? (int) $v['sub_part'] : null;
$tableIndexes[$k] = $v;
}
......
......@@ -107,6 +107,19 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
self::assertTrue($indexes['s_index']->hasFlag('spatial'));
}
public function testIndexWithLength() : void
{
$table = new Table('index_length');
$table->addColumn('text', 'string', ['length' => 255]);
$table->addIndex(['text'], 'text_index', [], ['lengths' => [128]]);
$this->schemaManager->dropAndCreateTable($table);
$indexes = $this->schemaManager->listTableIndexes('index_length');
self::assertArrayHasKey('text_index', $indexes);
self::assertSame([128], $indexes['text_index']->getOption('lengths'));
}
/**
* @group DBAL-400
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment