Skip to content

Commit

Permalink
Test createIndex() with method (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov authored Oct 16, 2023
1 parent 5535122 commit 940d988
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/MigrationBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ public function createIndex(
'Create'
. ($indexType !== null ? ' ' . $indexType : '')
. " index $name on $table (" . implode(',', (array) $columns) . ')'
. ($indexMethod !== null ? ' using ' . $indexMethod : '')
);
$this->db->createCommand()->createIndex($table, $name, $columns, $indexType, $indexMethod)->execute();
$this->endCommand($time);
Expand Down
4 changes: 2 additions & 2 deletions tests/Common/AbstractMigrationBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ public function testDropForeignKey(): void
public function testCreateIndex(): void
{
$this->builder->createTable('test_table', ['id' => 'int']);
$this->builder->createIndex('test_table', 'unique_index', 'id', 'UNIQUE');
$this->builder->createIndex('test_table', 'unique_index', 'id', 'UNIQUE', 'BTREE');

$indexes = $this->db->getSchema()->getTableIndexes('test_table');

Expand All @@ -434,7 +434,7 @@ public function testCreateIndex(): void
$this->assertTrue($index->isUnique());
$this->assertFalse($index->isPrimary());
$this->assertInformerOutputContains(
' > Create UNIQUE index unique_index on test_table (id) ... Done in ',
' > Create UNIQUE index unique_index on test_table (id) using BTREE ... Done in ',
);

$this->builder->dropTable('test_table');
Expand Down

0 comments on commit 940d988

Please sign in to comment.