Passed
Push — master ( d23c6f...8ae5f7 )
by Ion
09:25
created

Version20200507151039::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Infrastructure\Migrations;
6
7
use Doctrine\DBAL\Schema\Schema;
8
use Doctrine\Migrations\AbstractMigration;
9
10
final class Version20200507151039 extends AbstractMigration
11
{
12
    public function getDescription(): string
13
    {
14
        return 'Initialize database';
15
    }
16
17
    public function up(Schema $schema): void
18
    {
19
        $this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
20
21
        $this->addSql('CREATE TABLE object_entry (
22
          id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', 
23
          `key` VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_bin`, 
24
          created_at timestamp not null, 
25
          `value` JSON DEFAULT NULL, 
26
          UNIQUE INDEX key_date_idx (`key`, created_at), 
27
          PRIMARY KEY(id)
28
        ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
29
    }
30
31
    public function down(Schema $schema): void
32
    {
33
        $this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
34
35
        $this->addSql('DROP TABLE object_entry');
36
    }
37
}
38