1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace Shopware\Core\Migration; |
4
|
|
|
|
5
|
|
|
use Doctrine\DBAL\Connection; |
6
|
|
|
use Shopware\Core\Framework\Migration\MigrationStep; |
7
|
|
|
|
8
|
|
|
class Migration1536233010OrderAddress extends MigrationStep |
9
|
|
|
{ |
10
|
|
|
public function getCreationTimestamp(): int |
11
|
|
|
{ |
12
|
|
|
return 1536233010; |
13
|
|
|
} |
14
|
|
|
|
15
|
|
|
public function update(Connection $connection): void |
16
|
|
|
{ |
17
|
|
|
$connection->executeQuery(' |
18
|
|
|
CREATE TABLE `order_address` ( |
19
|
|
|
`id` BINARY(16) NOT NULL, |
20
|
|
|
`version_id` BINARY(16) NOT NULL, |
21
|
|
|
`country_id` BINARY(16) NOT NULL, |
22
|
|
|
`country_state_id` BINARY(16) NULL, |
23
|
|
|
`order_id` BINARY(16) NOT NULL, |
24
|
|
|
`order_version_id` BINARY(16) NOT NULL, |
25
|
|
|
`company` VARCHAR(255) COLLATE utf8mb4_unicode_ci NULL, |
26
|
|
|
`department` VARCHAR(35) COLLATE utf8mb4_unicode_ci NULL, |
27
|
|
|
`salutation_id` BINARY(16) NOT NULL, |
28
|
|
|
`title` VARCHAR(100) COLLATE utf8mb4_unicode_ci NULL, |
29
|
|
|
`first_name` VARCHAR(50) COLLATE utf8mb4_unicode_ci NOT NULL, |
30
|
|
|
`last_name` VARCHAR(60) COLLATE utf8mb4_unicode_ci NOT NULL, |
31
|
|
|
`street` VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL, |
32
|
|
|
`zipcode` VARCHAR(50) COLLATE utf8mb4_unicode_ci NOT NULL, |
33
|
|
|
`city` VARCHAR(70) COLLATE utf8mb4_unicode_ci NOT NULL, |
34
|
|
|
`vat_id` VARCHAR(50) COLLATE utf8mb4_unicode_ci NULL, |
35
|
|
|
`phone_number` VARCHAR(40) COLLATE utf8mb4_unicode_ci NULL, |
36
|
|
|
`additional_address_line1` VARCHAR(255) COLLATE utf8mb4_unicode_ci NULL, |
37
|
|
|
`additional_address_line2` VARCHAR(255) COLLATE utf8mb4_unicode_ci NULL, |
38
|
|
|
`custom_fields` JSON NULL, |
39
|
|
|
`created_at` DATETIME(3) NOT NULL, |
40
|
|
|
`updated_at` DATETIME(3) NULL, |
41
|
|
|
PRIMARY KEY (`id`, `version_id`), |
42
|
|
|
CONSTRAINT `json.order_address.custom_fields` CHECK (JSON_VALID(`custom_fields`)), |
43
|
|
|
CONSTRAINT `fk.order_address.country_id` FOREIGN KEY (`country_id`) |
44
|
|
|
REFERENCES `country` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE, |
45
|
|
|
CONSTRAINT `fk.order_address.country_state_id` FOREIGN KEY (`country_state_id`) |
46
|
|
|
REFERENCES `country_state` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, |
47
|
|
|
CONSTRAINT `fk.order_address.order_id` FOREIGN KEY (`order_id`, `order_version_id`) |
48
|
|
|
REFERENCES `order` (`id`, `version_id`) ON DELETE CASCADE ON UPDATE CASCADE, |
49
|
|
|
CONSTRAINT `fk.order_address.salutation_id` FOREIGN KEY (`salutation_id`) |
50
|
|
|
REFERENCES `salutation` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE |
51
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
52
|
|
|
'); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function updateDestructive(Connection $connection): void |
56
|
|
|
{ |
57
|
|
|
// implement update destructive |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|