|
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 Migration1536232930Navigation extends MigrationStep |
|
9
|
|
|
{ |
|
10
|
|
|
public function getCreationTimestamp(): int |
|
11
|
|
|
{ |
|
12
|
|
|
return 1536232930; |
|
13
|
|
|
} |
|
14
|
|
|
|
|
15
|
|
|
public function update(Connection $connection): void |
|
16
|
|
|
{ |
|
17
|
|
|
$connection->executeQuery(' |
|
18
|
|
|
CREATE TABLE `navigation` ( |
|
19
|
|
|
`id` BINARY(16) NOT NULL, |
|
20
|
|
|
`version_id` BINARY(16) NOT NULL, |
|
21
|
|
|
`parent_id` BINARY(16) NULL, |
|
22
|
|
|
`parent_version_id` BINARY(16) NULL, |
|
23
|
|
|
`category_id` BINARY(16) NULL, |
|
24
|
|
|
`category_version_id` BINARY(16) NULL, |
|
25
|
|
|
`path` LONGTEXT COLLATE utf8mb4_unicode_ci, |
|
26
|
|
|
`level` INT(11) unsigned NOT NULL DEFAULT \'1\', |
|
27
|
|
|
`child_count` INT(11) unsigned NOT NULL DEFAULT \'0\', |
|
28
|
|
|
`cms_page_id` BINARY(16) NULL, |
|
29
|
|
|
`created_at` DATETIME(3) NOT NULL, |
|
30
|
|
|
`updated_at` DATETIME(3), |
|
31
|
|
|
PRIMARY KEY (`id`, `version_id`), |
|
32
|
|
|
KEY `idx.navigation.level` (`level`), |
|
33
|
|
|
CONSTRAINT `fk.navigation.parent_id` FOREIGN KEY (`parent_id`, `parent_version_id`) |
|
34
|
|
|
REFERENCES `navigation` (`id`, `version_id`) ON DELETE CASCADE ON UPDATE CASCADE, |
|
35
|
|
|
CONSTRAINT `fk.navigation.cms_page_id` FOREIGN KEY (`cms_page_id`) |
|
36
|
|
|
REFERENCES `cms_page` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, |
|
37
|
|
|
CONSTRAINT `fk.navigation.category_id` FOREIGN KEY (`category_id`, `category_version_id`) |
|
38
|
|
|
REFERENCES `category` (`id`, `version_id`) ON DELETE CASCADE ON UPDATE CASCADE |
|
39
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
|
40
|
|
|
'); |
|
41
|
|
|
|
|
42
|
|
|
$connection->executeQuery(' |
|
43
|
|
|
CREATE TABLE `navigation_translation` ( |
|
44
|
|
|
`navigation_id` BINARY(16) NOT NULL, |
|
45
|
|
|
`navigation_version_id` BINARY(16) NOT NULL, |
|
46
|
|
|
`language_id` BINARY(16) NOT NULL, |
|
47
|
|
|
`name` VARCHAR(255) COLLATE utf8mb4_unicode_ci NULL, |
|
48
|
|
|
`slot_config` JSON, |
|
49
|
|
|
`created_at` DATETIME(3) NOT NULL, |
|
50
|
|
|
`updated_at` DATETIME(3), |
|
51
|
|
|
PRIMARY KEY (`navigation_id`, `navigation_version_id`, `language_id`), |
|
52
|
|
|
CONSTRAINT `json.navigation_translation.slot_config` CHECK (JSON_VALID(`slot_config`)), |
|
53
|
|
|
CONSTRAINT `fk.navigation_translation.language_id` FOREIGN KEY (`language_id`) |
|
54
|
|
|
REFERENCES `language` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, |
|
55
|
|
|
CONSTRAINT `fk.navigation_translation.navigation_id` FOREIGN KEY (`navigation_id`, `navigation_version_id`) |
|
56
|
|
|
REFERENCES `navigation` (`id`, `version_id`) ON DELETE CASCADE ON UPDATE CASCADE |
|
57
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
|
58
|
|
|
'); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function updateDestructive(Connection $connection): void |
|
62
|
|
|
{ |
|
63
|
|
|
// implement update destructive |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|