Commit 06083726 authored by Leo Feyer's avatar Leo Feyer

Cast the index length to int in the MySqlSchemaManager class

parent f28f3a83
......@@ -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