Passed
Pull Request — master (#221)
by
unknown
04:53 queued 01:58
created

Version20211229215408::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zenstruck\Foundry\Tests\Fixtures\Migrations;
6
7
use Doctrine\DBAL\Schema\Schema;
8
use Doctrine\Migrations\AbstractMigration;
9
10
/**
11
 * Auto-generated Migration: Please modify to your needs!
12
 */
13
final class Version20211229215408 extends AbstractMigration
14
{
15
    public function getDescription(): string
16
    {
17
        return '';
18
    }
19
20
    public function up(Schema $schema): void
21
    {
22
        // this up() migration is auto-generated, please modify it to your needs
23
        $this->addSql('CREATE TABLE entity_with_relations (id INT AUTO_INCREMENT NOT NULL, one_to_one_id INT NOT NULL, one_to_one_nullable_id INT DEFAULT NULL, many_to_one_id INT NOT NULL, many_to_one_nullable_id INT DEFAULT NULL, many_to_one_nullable_default_id INT DEFAULT NULL, UNIQUE INDEX UNIQ_A9C9EC96B549C760 (one_to_one_id), UNIQUE INDEX UNIQ_A9C9EC962C1E3906 (one_to_one_nullable_id), INDEX IDX_A9C9EC96EAB5DEB (many_to_one_id), INDEX IDX_A9C9EC96926C5B25 (many_to_one_nullable_id), INDEX IDX_A9C9EC968226E90E (many_to_one_nullable_default_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
24
        $this->addSql('CREATE TABLE entity_with_relations_category (entity_with_relations_id INT NOT NULL, category_id INT NOT NULL, INDEX IDX_22EACD458FACC72F (entity_with_relations_id), INDEX IDX_22EACD4512469DE2 (category_id), PRIMARY KEY(entity_with_relations_id, category_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
25
        $this->addSql('ALTER TABLE entity_with_relations ADD CONSTRAINT FK_A9C9EC96B549C760 FOREIGN KEY (one_to_one_id) REFERENCES categories (id)');
26
        $this->addSql('ALTER TABLE entity_with_relations ADD CONSTRAINT FK_A9C9EC962C1E3906 FOREIGN KEY (one_to_one_nullable_id) REFERENCES categories (id)');
27
        $this->addSql('ALTER TABLE entity_with_relations ADD CONSTRAINT FK_A9C9EC96EAB5DEB FOREIGN KEY (many_to_one_id) REFERENCES categories (id)');
28
        $this->addSql('ALTER TABLE entity_with_relations ADD CONSTRAINT FK_A9C9EC96926C5B25 FOREIGN KEY (many_to_one_nullable_id) REFERENCES categories (id)');
29
        $this->addSql('ALTER TABLE entity_with_relations ADD CONSTRAINT FK_A9C9EC968226E90E FOREIGN KEY (many_to_one_nullable_default_id) REFERENCES categories (id)');
30
        $this->addSql('ALTER TABLE entity_with_relations_category ADD CONSTRAINT FK_22EACD458FACC72F FOREIGN KEY (entity_with_relations_id) REFERENCES entity_with_relations (id) ON DELETE CASCADE');
31
        $this->addSql('ALTER TABLE entity_with_relations_category ADD CONSTRAINT FK_22EACD4512469DE2 FOREIGN KEY (category_id) REFERENCES categories (id) ON DELETE CASCADE');
32
    }
33
34
    public function down(Schema $schema): void
35
    {
36
    }
37
}
38