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');