diff --git a/CHANGELOG_de-DE.md b/CHANGELOG_de-DE.md index ead54ef9..f7d9d01d 100644 --- a/CHANGELOG_de-DE.md +++ b/CHANGELOG_de-DE.md @@ -1,3 +1,7 @@ +# 7.1.1 +* Bugfix PHP8.2 Kompatibilität +* Fix foreign key issue in Migrationen + # 7.1.0 * Migration von Unzer UI Component V1 zu Unzer UI Component V2 * Express-Checkout für Apple Pay, Google Pay und PayPal wurde hinzugefügt diff --git a/CHANGELOG_en-GB.md b/CHANGELOG_en-GB.md index 70a54c8e..e6f61f24 100644 --- a/CHANGELOG_en-GB.md +++ b/CHANGELOG_en-GB.md @@ -1,3 +1,7 @@ +# 7.1.1 +* Fix foreign key issue in migrations +* PHP8.2 compatibility fix + # 7.1.0 * Migration from Unzer UI Component V1 to Unzer UI Component V2 * Express checkout for Apple Pay, Google Pay and Paypal has been added diff --git a/composer.json b/composer.json index 786e0b33..b4974d22 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "unzerdev/shopware6", "description": "Unzer payment integration for Shopware 6", - "version": "7.1.0", + "version": "7.1.1", "type": "shopware-platform-plugin", "license": "Apache-2.0", "minimum-stability": "dev", diff --git a/src/Components/PaymentHandler/AbstractUnzerPaymentHandler.php b/src/Components/PaymentHandler/AbstractUnzerPaymentHandler.php index 720d0908..6104d1fe 100755 --- a/src/Components/PaymentHandler/AbstractUnzerPaymentHandler.php +++ b/src/Components/PaymentHandler/AbstractUnzerPaymentHandler.php @@ -42,7 +42,7 @@ abstract class AbstractUnzerPaymentHandler extends AbstractPaymentHandler { use ExceptionHandler; - public const string SAVE_PAYMENT_DEVICE_KEY = 'save_payment_device'; + public const SAVE_PAYMENT_DEVICE_KEY = 'save_payment_device'; protected ?BasePaymentType $paymentType = null; diff --git a/src/Migration/Migration1564149494AddPaymentDeviceVault.php b/src/Migration/Migration1564149494AddPaymentDeviceVault.php index c3707235..cf76742f 100644 --- a/src/Migration/Migration1564149494AddPaymentDeviceVault.php +++ b/src/Migration/Migration1564149494AddPaymentDeviceVault.php @@ -26,19 +26,13 @@ public function update(Connection $connection): void CREATE TABLE IF NOT EXISTS `heidelpay_payment_device` ( `id` binary(16) NOT NULL, `customer_id` BINARY(16) NOT NULL, - `device_type` VARCHAR(16) NOT NULL, + `device_type` VARCHAR(32) COLLATE 'utf8mb4_unicode_ci' NOT NULL, `type_id` VARCHAR(32) NOT NULL, `data` TEXT NOT NULL, `created_at` DATETIME(3) NOT NULL, `updated_at` DATETIME(3) NULL, - PRIMARY KEY (`id`), - KEY `fk.heidelpay_payment_device.customer_id` (`customer_id`), - - CONSTRAINT `fk.heidelpay_payment_device.customer_id` - FOREIGN KEY (`customer_id`) - REFERENCES `customer` (`id`) - ON DELETE RESTRICT ON UPDATE CASCADE + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; SQL; diff --git a/src/Migration/Migration1579964350AddTransferInfoTable.php b/src/Migration/Migration1579964350AddTransferInfoTable.php index 16a02bcc..27dc6519 100644 --- a/src/Migration/Migration1579964350AddTransferInfoTable.php +++ b/src/Migration/Migration1579964350AddTransferInfoTable.php @@ -34,13 +34,7 @@ public function update(Connection $connection): void `created_at` DATETIME(3) NOT NULL, `updated_at` DATETIME(3) NULL, - PRIMARY KEY (`id`), - KEY `fk.heidelpay_transfer_info.transaction_id` (`transaction_id`), - - CONSTRAINT `fk.heidelpay_transfer_info.transaction_id` - FOREIGN KEY (`transaction_id`) - REFERENCES `order_transaction` (`id`) - ON DELETE RESTRICT ON UPDATE CASCADE + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; SQL; diff --git a/src/Migration/Migration1605179799ForeignKeyChanges.php b/src/Migration/Migration1605179799ForeignKeyChanges.php index 6b0ef316..6d487194 100644 --- a/src/Migration/Migration1605179799ForeignKeyChanges.php +++ b/src/Migration/Migration1605179799ForeignKeyChanges.php @@ -16,35 +16,37 @@ public function getCreationTimestamp(): int public function update(Connection $connection): void { - $transferInfoSql = $connection->fetchOne('SHOW KEYS FROM `unzer_payment_transfer_info` WHERE Key_name = "fk.heidelpay_transfer_info.transaction_id";'); - - if (!$transferInfoSql) { - $connection->executeStatement( - <<fetchOne('SHOW KEYS FROM `unzer_payment_payment_device` WHERE Key_name = "fk.heidelpay_payment_device.customer_id";'); - - if (!$paymentDeviceResult) { - $connection->executeStatement( - <<fetchOne('SHOW KEYS FROM `unzer_payment_transfer_info` WHERE Key_name = "fk.heidelpay_transfer_info.transaction_id";'); +// +// if (!$transferInfoSql) { +// $connection->executeStatement( +// <<fetchOne('SHOW KEYS FROM `unzer_payment_payment_device` WHERE Key_name = "fk.heidelpay_payment_device.customer_id";'); +// +// if (!$paymentDeviceResult) { +// $connection->executeStatement( +// <<fetchAssociative( - 'SHOW KEYS FROM `unzer_payment_payment_device` WHERE Key_name = "fk.heidelpay_payment_device.customer_id";' - ); - - if (!empty($paymentDeviceResult)) { $this->dropForeignKey($connection, 'unzer_payment_payment_device', 'fk.heidelpay_payment_device.customer_id'); + $this->dropForeignKey($connection, 'unzer_payment_payment_device', 'fk.unzer_payment_payment_device.customer_id'); $this->dropIndex($connection, 'unzer_payment_payment_device', 'fk.heidelpay_payment_device.customer_id'); try { @@ -75,7 +71,7 @@ private function migratePaymentDevices(Connection $connection): void } catch (\Throwable $t) { // silentfail - already created } - } + } private function dropForeignKey(Connection $connection, string $table, string $keyName): void