From 06da0d8711baf9f2fc00d0f2cff3199816a5ca18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Pocrnji=C4=8D?= Date: Thu, 2 Oct 2025 22:13:29 +0200 Subject: [PATCH] deleted problematic migration --- ...nique_index_payments_account_reference.php | 41 ------------------- 1 file changed, 41 deletions(-) delete mode 100644 database/migrations/2025_10_02_000020_add_unique_index_payments_account_reference.php diff --git a/database/migrations/2025_10_02_000020_add_unique_index_payments_account_reference.php b/database/migrations/2025_10_02_000020_add_unique_index_payments_account_reference.php deleted file mode 100644 index 4d869b1..0000000 --- a/database/migrations/2025_10_02_000020_add_unique_index_payments_account_reference.php +++ /dev/null @@ -1,41 +0,0 @@ -hasUniqueIndex('payments', 'payments_account_id_reference_unique')) { - $table->unique(['account_id', 'reference'], 'payments_account_id_reference_unique'); - } - }); - } - - public function down(): void - { - Schema::table('payments', function (Blueprint $table): void { - if ($this->hasUniqueIndex('payments', 'payments_account_id_reference_unique')) { - $table->dropUnique('payments_account_id_reference_unique'); - } - }); - } - - private function hasUniqueIndex(string $table, string $indexName): bool - { - // Works for both SQLite and others by checking existing indexes from connection schema manager when available. - try { - $connection = Schema::getConnection(); - $schemaManager = $connection->getDoctrineSchemaManager(); - $indexes = $schemaManager->listTableIndexes($table); - - return array_key_exists($indexName, $indexes); - } catch (\Throwable $e) { - // Fallback: attempt dropping/creating blindly in migration operations - return false; - } - } -};