Passed
Pull Request — master (#5963)
by
unknown
20:47
created

Version20241211183300::down()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 2
nc 2
nop 1
dl 0
loc 4
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
8
9
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
10
use Doctrine\DBAL\Schema\Schema;
11
12
final class Version20241211183300 extends AbstractMigrationChamilo
13
{
14
    public function getDescription(): string
15
    {
16
        return 'Migration for creating the validation_token table';
17
    }
18
19
    public function up(Schema $schema): void
20
    {
21
        if (!$schema->hasTable('validation_token')) {
22
            $this->addSql("
23
                CREATE TABLE validation_token (
24
                    id INT AUTO_INCREMENT NOT NULL,
25
                    type INT NOT NULL,
26
                    resource_id BIGINT NOT NULL,
27
                    hash CHAR(64) NOT NULL,
28
                    created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)',
29
                    INDEX idx_type_hash (type, hash),
30
                    PRIMARY KEY(id)
31
                ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC
32
            ");
33
        }
34
    }
35
36
    public function down(Schema $schema): void
37
    {
38
        if ($schema->hasTable('validation_token')) {
39
            $this->addSql('DROP TABLE validation_token');
40
        }
41
    }
42
}
43