diff --git a/src/Prometheus/Storage/PDO.php b/src/Prometheus/Storage/PDO.php index ab0e756..80b6ec5 100644 --- a/src/Prometheus/Storage/PDO.php +++ b/src/Prometheus/Storage/PDO.php @@ -641,7 +641,7 @@ protected function createTables(): void `time` {$timestamp_type} NOT NULL ); SQL; - $sqlIndex = "CREATE INDEX `name` ON `{$this->prefix}_summaries`(`name`);"; + $sqlIndex = "CREATE INDEX IF NOT EXISTS `name` ON `{$this->prefix}_summaries`(`name`);"; break; case 'mysql': @@ -667,7 +667,7 @@ protected function createTables(): void "time" {$timestamp_type} NOT NULL ); SQL; - $sqlIndex = "CREATE INDEX \"name\" ON \"{$this->prefix}_summaries\" (\"name\");"; + $sqlIndex = "CREATE INDEX IF NOT EXISTS \"name\" ON \"{$this->prefix}_summaries\" (\"name\");"; break; }