Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG_de-DE.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG_en-GB.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
10 changes: 2 additions & 8 deletions src/Migration/Migration1564149494AddPaymentDeviceVault.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 1 addition & 7 deletions src/Migration/Migration1579964350AddTransferInfoTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
60 changes: 31 additions & 29 deletions src/Migration/Migration1605179799ForeignKeyChanges.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<<<SQL
ALTER TABLE unzer_payment_transfer_info
DROP FOREIGN KEY `fk.heidelpay_transfer_info.transaction_id`,
ADD CONSTRAINT `fk.unzer_payment_transfer_info.transaction_id`
FOREIGN KEY (`transaction_id`)
REFERENCES `order_transaction` (`id`)
ON DELETE RESTRICT ON UPDATE CASCADE
SQL
);
}

$paymentDeviceResult = $connection->fetchOne('SHOW KEYS FROM `unzer_payment_payment_device` WHERE Key_name = "fk.heidelpay_payment_device.customer_id";');

if (!$paymentDeviceResult) {
$connection->executeStatement(
<<<SQL
ALTER TABLE unzer_payment_payment_device
DROP FOREIGN KEY `fk.heidelpay_payment_device.customer_id`,
ADD CONSTRAINT `fk.unzer_payment_payment_device.customer_id`
FOREIGN KEY (`customer_id`)
REFERENCES `customer` (`id`)
ON DELETE RESTRICT ON UPDATE CASCADE
SQL
);
}
//this is taken care of by Migration1612513284FixForeignKeyHandling

// $transferInfoSql = $connection->fetchOne('SHOW KEYS FROM `unzer_payment_transfer_info` WHERE Key_name = "fk.heidelpay_transfer_info.transaction_id";');
//
// if (!$transferInfoSql) {
// $connection->executeStatement(
// <<<SQL
// ALTER TABLE unzer_payment_transfer_info
// DROP FOREIGN KEY `fk.heidelpay_transfer_info.transaction_id`,
// ADD CONSTRAINT `fk.unzer_payment_transfer_info.transaction_id`
// FOREIGN KEY (`transaction_id`)
// REFERENCES `order_transaction` (`id`)
// ON DELETE RESTRICT ON UPDATE CASCADE
//SQL
// );
// }
//
// $paymentDeviceResult = $connection->fetchOne('SHOW KEYS FROM `unzer_payment_payment_device` WHERE Key_name = "fk.heidelpay_payment_device.customer_id";');
//
// if (!$paymentDeviceResult) {
// $connection->executeStatement(
// <<<SQL
// ALTER TABLE unzer_payment_payment_device
// DROP FOREIGN KEY `fk.heidelpay_payment_device.customer_id`,
// ADD CONSTRAINT `fk.unzer_payment_payment_device.customer_id`
// FOREIGN KEY (`customer_id`)
// REFERENCES `customer` (`id`)
// ON DELETE RESTRICT ON UPDATE CASCADE
//SQL
// );
// }
}

public function updateDestructive(Connection $connection): void
Expand Down
8 changes: 2 additions & 6 deletions src/Migration/Migration1612513284FixForeignKeyHandling.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,8 @@ private function migrateTransferInfo(Connection $connection): void

private function migratePaymentDevices(Connection $connection): void
{
$paymentDeviceResult = $connection->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 {
Expand All @@ -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
Expand Down