Skip to content

Commit

Permalink
Add functional test about partial indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
bburnichon committed Sep 10, 2018
1 parent e910a11 commit f3135bd
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1517,4 +1517,24 @@ public function testPrimaryKeyAutoIncrement()

$this->assertGreaterThan($lastUsedIdBeforeDelete, $lastUsedIdAfterDelete);
}

public function testGenerateAnIndexWithPartialColumnLength() : void
{
if (! $this->_sm->getDatabasePlatform()->supportsColumnLengthIndexes()) {
self::markTestSkipped('This test is only supported on platforms that support indexes with column length definitions.');
}

$table = new Table('test_partial_column_index');
$table->addColumn('long_column', 'string', ['length' => 40]);
$table->addColumn('standard_column', 'integer');
$table->addIndex(['long_column'], 'partial_long_column_idx', [], ['lengths' => [4]]);
$table->addIndex(['standard_column', 'long_column'], 'standard_and_partial_idx', [], ['lengths' => [null, 2]]);

$expected = $table->getIndexes();

$this->_sm->dropAndCreateTable($table);

$onlineTable = $this->_sm->listTableDetails('test_partial_column_index');
self::assertEquals($expected, $onlineTable->getIndexes());
}
}

0 comments on commit f3135bd

Please sign in to comment.