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 Aug 31, 2018
1 parent f883c9c commit d0f3e1c
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -478,4 +478,22 @@ public function testEnsureDefaultsAreUnescapedFromSchemaIntrospection() : void
$onlineTable = $this->_sm->listTableDetails("test_column_defaults_with_create");
self::assertSame($default, $onlineTable->getColumn('col1')->getDefault());
}

public function testGenerateAnIndexWithPartialColumnLength() : void
{
$this->_conn->query('DROP TABLE IF EXISTS test_partial_column_index');

$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 d0f3e1c

Please sign in to comment.