Passed
Pull Request — master (#488)
by Andrew
04:30
created

Version20180206181038   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 7
dl 0
loc 24
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Application\Migrations;
4
5
use Doctrine\DBAL\Migrations\AbstractMigration;
6
use Doctrine\DBAL\Schema\Schema;
7
8
/**
9
 * Auto-generated Migration: Please modify to your needs!
10
 */
11
class Version20180206181038 extends AbstractMigration
12
{
13
    /**
14
     * @param Schema $schema
15
     */
16
    public function up(Schema $schema)
17
    {
18
        // this up() migration is auto-generated, please modify it to your needs
19
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
20
21
        $this->addSql('CREATE TABLE event_speakers_committee (speaker_id INT NOT NULL, event_id INT NOT NULL, INDEX IDX_A1D0B356D04A0F27 (speaker_id), INDEX IDX_A1D0B35671F7E88B (event_id), PRIMARY KEY(speaker_id, event_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
22
        $this->addSql('ALTER TABLE event_speakers_committee ADD CONSTRAINT FK_A1D0B356D04A0F27 FOREIGN KEY (speaker_id) REFERENCES event__speakers (id) ON DELETE CASCADE');
23
        $this->addSql('ALTER TABLE event_speakers_committee ADD CONSTRAINT FK_A1D0B35671F7E88B FOREIGN KEY (event_id) REFERENCES event__events (id) ON DELETE CASCADE');
24
    }
25
26
    /**
27
     * @param Schema $schema
28
     */
29
    public function down(Schema $schema)
30
    {
31
        // this down() migration is auto-generated, please modify it to your needs
32
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
33
34
        $this->addSql('DROP TABLE event_speakers_committee');
35
    }
36
}
37