From d96e9a8e03565d3637d16402871697f45d7675e1 Mon Sep 17 00:00:00 2001 From: stranac Date: Fri, 2 Jul 2021 18:07:59 +0200 Subject: [PATCH] ->db->query( --- upload/admin/model/extension/payment/coingate.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/upload/admin/model/extension/payment/coingate.php b/upload/admin/model/extension/payment/coingate.php index 2f0c6e8..10e3872 100644 --- a/upload/admin/model/extension/payment/coingate.php +++ b/upload/admin/model/extension/payment/coingate.php @@ -13,10 +13,17 @@ public function install() { "); // Modify the currency table to allow 4-character currency code - $this->db->query(" - ALTER TABLE `" . DB_PREFIX . "currency` - MODIFY `code` VARCHAR(4) COLLATE utf8_general_ci NOT NULL; + $query = $this->db->query(" + SELECT character_maximum_length + FROM information_schema.columns + WHERE table_name = '" . DB_PREFIX . "currency' and column_name = 'code'; "); + if ((int)$query->row['character_maximum_length'] < 4) { + $this->db->query(" + ALTER TABLE `" . DB_PREFIX . "currency` + MODIFY `code` VARCHAR(4) COLLATE utf8_general_ci NOT NULL; + "); + } $this->load->model('setting/setting');