From fbbc6114acfdbfd1d46a82e5946d17823cdd92fc Mon Sep 17 00:00:00 2001 From: Edie Lemoine Date: Thu, 30 Nov 2023 13:35:05 +0100 Subject: [PATCH] fix(database): fix creating indexes on certain db drivers --- src/Database/Sql/CreateIndexSqlBuilder.php | 2 +- tests/Unit/Database/Sql/CreateIndexSqlBuilderTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Database/Sql/CreateIndexSqlBuilder.php b/src/Database/Sql/CreateIndexSqlBuilder.php index 3a6c8ad8..72c8bef6 100644 --- a/src/Database/Sql/CreateIndexSqlBuilder.php +++ b/src/Database/Sql/CreateIndexSqlBuilder.php @@ -19,7 +19,7 @@ final class CreateIndexSqlBuilder extends SqlBuilder public function build(): string { return sprintf( - 'CREATE INDEX IF NOT EXISTS `%s` ON `%s` (%s);', + 'CREATE INDEX `%s` ON `%s` (%s);', $this->index, $this->getTable(), implode(', ', $this->columns) diff --git a/tests/Unit/Database/Sql/CreateIndexSqlBuilderTest.php b/tests/Unit/Database/Sql/CreateIndexSqlBuilderTest.php index 8b353578..4f139905 100644 --- a/tests/Unit/Database/Sql/CreateIndexSqlBuilderTest.php +++ b/tests/Unit/Database/Sql/CreateIndexSqlBuilderTest.php @@ -11,7 +11,7 @@ $builder->index('index_123', ['column1', 'column2']); $result = <<build())->toEqual($result);