From: Aleksey Filippov Date: Tue, 17 Feb 2026 06:42:02 +0000 (+0300) Subject: Добавление логирования на загрузку файлов в документ списания. X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=b141bdf5f8041084e511e12f3ad132d1d196e665;p=erp24_rep%2Fyii-erp24%2F.git Добавление логирования на загрузку файлов в документ списания. --- diff --git a/erp24/migrations/m260212_120000_add_marketplace_fields_to_sales.php b/erp24/migrations/m260212_120000_add_marketplace_fields_to_sales.php index 4727b9a3..b40e9233 100644 --- a/erp24/migrations/m260212_120000_add_marketplace_fields_to_sales.php +++ b/erp24/migrations/m260212_120000_add_marketplace_fields_to_sales.php @@ -41,18 +41,22 @@ class m260212_120000_add_marketplace_fields_to_sales extends Migration } // Добавляем индекс для быстрого поиска по marketplace_order_id - $this->createIndex( - 'idx-sales-marketplace_order_id', - self::TABLE_NAME, - 'marketplace_order_id' - ); + if (!$this->indexExists('idx-sales-marketplace_order_id')) { + $this->createIndex( + 'idx-sales-marketplace_order_id', + self::TABLE_NAME, + 'marketplace_order_id' + ); + } // Добавляем составной индекс для аналитики по маркетплейсам - $this->createIndex( - 'idx-sales-marketplace_name_date', - self::TABLE_NAME, - ['marketplace_name', 'date'] - ); + if (!$this->indexExists('idx-sales-marketplace_name_date')) { + $this->createIndex( + 'idx-sales-marketplace_name_date', + self::TABLE_NAME, + ['marketplace_name', 'date'] + ); + } echo " > Поля marketplace_order_id и marketplace_name успешно добавлены в таблицу erp24.sales\n"; } @@ -77,4 +81,13 @@ class m260212_120000_add_marketplace_fields_to_sales extends Migration echo " > Поля marketplace_order_id и marketplace_name удалены из таблицы erp24.sales\n"; } + + private function indexExists(string $indexName): bool + { + $result = $this->db->createCommand( + "SELECT 1 FROM pg_indexes WHERE indexname = :name" + )->bindValue(':name', $indexName)->queryScalar(); + + return $result !== false; + } }