Version20241009183226::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 18
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
use Doctrine\DBAL\Schema\Schema;
6
use Doctrine\Migrations\AbstractMigration;
0 ignored issues
show
Bug introduced by
The type Doctrine\Migrations\AbstractMigration was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
final class Version20241009183226 extends AbstractMigration
9
{
10
    public function up(Schema $schema): void
11
    {
12
        $this->addSql(
13
            <<<'SQL'
14
            CREATE TABLE `event_store` (
15
              `id` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
16
              `event_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
17
              `payload` json NOT NULL,
18
              `metadata` json NOT NULL,
19
              `applied_at` timestamp(6) NOT NULL,
20
              PRIMARY KEY (`id`),
21
              KEY `event_name` (`event_name`)
22
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
23
            SQL
24
        );
25
26
        $this->addSql(
27
            <<<'SQL'
28
            CREATE TABLE `event_store_relation` (
29
              `event_id` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
30
              `domain_id` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
31
              PRIMARY KEY (`event_id`,`domain_id`),
32
              CONSTRAINT `event_store_relation_ibfk_1` FOREIGN KEY (`event_id`) REFERENCES `event_store` (`id`)
33
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
34
            SQL
35
        );
36
    }
37
}
38