Version20220312135411   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getDescription() 0 4 1
A down() 0 11 1
A up() 0 11 1
1
<?php
2
declare(strict_types = 1);
3
4
// phpcs:ignoreFile
5
namespace DoctrineMigrations;
6
7
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
8
use Doctrine\DBAL\Schema\Schema;
9
use Doctrine\Migrations\AbstractMigration;
10
use Override;
11
12
/**
13
 * Auto-generated Migration: Please modify to your needs!
14
 */
15
final class Version20220312135411 extends AbstractMigration
16
{
17
    /**
18
     * @noinspection PhpMissingParentCallCommonInspection
19
     */
20
    #[Override]
21
    public function getDescription(): string
22
    {
23
        return 'Added missing cascade on delete for the `log_login_failure` table';
24
    }
25
26
    #[Override]
27
    public function up(Schema $schema): void
28
    {
29
        // this up() migration is auto-generated, please modify it to your needs
30
        $this->abortIf(
31
            !$this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform,
32
            'Migration can only be executed safely on \'mysql\'.'
33
        );
34
35
        $this->addSql('ALTER TABLE log_login_failure DROP FOREIGN KEY FK_EDB4AF3A76ED395');
36
        $this->addSql('ALTER TABLE log_login_failure ADD CONSTRAINT FK_EDB4AF3A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE');
37
    }
38
39
    /**
40
     * @noinspection PhpMissingParentCallCommonInspection
41
     */
42
    #[Override]
43
    public function down(Schema $schema): void
44
    {
45
        // this down() migration is auto-generated, please modify it to your needs
46
        $this->abortIf(
47
            !$this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform,
48
            'Migration can only be executed safely on \'mysql\'.'
49
        );
50
51
        $this->addSql('ALTER TABLE log_login_failure DROP FOREIGN KEY FK_EDB4AF3A76ED395');
52
        $this->addSql('ALTER TABLE log_login_failure ADD CONSTRAINT FK_EDB4AF3A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
53
    }
54
}
55