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 Migration1536233410PromotionSalesChannel extends MigrationStep |
9
|
|
|
{ |
10
|
|
|
public function getCreationTimestamp(): int |
11
|
|
|
{ |
12
|
|
|
return 1536233410; |
13
|
|
|
} |
14
|
|
|
|
15
|
|
|
public function update(Connection $connection): void |
16
|
|
|
{ |
17
|
|
|
$connection->executeQuery(' |
18
|
|
|
CREATE TABLE IF NOT EXISTS `promotion_sales_channel` ( |
19
|
|
|
`id` BINARY(16) NOT NULL, |
20
|
|
|
`promotion_id` BINARY(16) NOT NULL, |
21
|
|
|
`sales_channel_id` BINARY(16) NOT NULL, |
22
|
|
|
`priority` INT NOT NULL DEFAULT 0, |
23
|
|
|
`created_at` DATETIME(3) NOT NULL, |
24
|
|
|
`updated_at` DATETIME(3) NULL, |
25
|
|
|
PRIMARY KEY (`id`), |
26
|
|
|
INDEX `idx.promotion_sales_channel.sales_channel_id` (`sales_channel_id` ASC), |
27
|
|
|
INDEX `idx.promotion_sales_channel.promotion_id` (`promotion_id` ASC), |
28
|
|
|
CONSTRAINT `fk.promotion_sales_channel.promotion_id` FOREIGN KEY (`promotion_id`) |
29
|
|
|
REFERENCES `promotion` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, |
30
|
|
|
CONSTRAINT `fk.promotion_sales_channel.sales_channel_id` FOREIGN KEY (`sales_channel_id`) |
31
|
|
|
REFERENCES `sales_channel` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION |
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
|
|
|
|