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 Migration1536232750Snippet extends MigrationStep |
9
|
|
|
{ |
10
|
|
|
public function getCreationTimestamp(): int |
11
|
|
|
{ |
12
|
|
|
return 1536232750; |
13
|
|
|
} |
14
|
|
|
|
15
|
|
|
public function update(Connection $connection): void |
16
|
|
|
{ |
17
|
|
|
$connection->executeQuery(' |
18
|
|
|
CREATE TABLE `snippet` ( |
19
|
|
|
`id` BINARY(16) NOT NULL, |
20
|
|
|
`translation_key` VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL, |
21
|
|
|
`value` LONGTEXT COLLATE utf8mb4_unicode_ci NOT NULL, |
22
|
|
|
`author` VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL, |
23
|
|
|
`snippet_set_id` BINARY(16) NOT NULL, |
24
|
|
|
`custom_fields` JSON NULL, |
25
|
|
|
`created_at` DATETIME(3) NOT NULL, |
26
|
|
|
`updated_at` DATETIME(3) NULL, |
27
|
|
|
PRIMARY KEY (`id`), |
28
|
|
|
UNIQUE `uniq.snippet_set_id_translation_key` (`snippet_set_id`, `translation_key`), |
29
|
|
|
CONSTRAINT `json.snippet.custom_fields` CHECK (JSON_VALID(`custom_fields`)), |
30
|
|
|
CONSTRAINT `fk.snippet.snippet_set_id` FOREIGN KEY (`snippet_set_id`) |
31
|
|
|
REFERENCES `snippet_set` (`id`) ON DELETE CASCADE ON UPDATE CASCADE |
32
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
33
|
|
|
'); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function updateDestructive(Connection $connection): void |
37
|
|
|
{ |
38
|
|
|
// implement update destructive |
39
|
|
|
} |
40
|
|
|
} |
41
|
|
|
|