Passed
Push — master ( 5a4fe7...aa8564 )
by Stepan
04:27
created

Version20111103110908   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 13
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
    Doctrine\DBAL\Schema\Schema;
7
8
/**
9
 * Auto-generated Migration: Please modify to your need!
10
 */
11
class Version20111103110908 extends AbstractMigration
12
{
13
    public function up(Schema $schema)
14
    {
15
        // this up() migration is autogenerated, please modify it to your needs
16
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
17
        
18
        $this->addSql("DROP TABLE event__events_mails");
19
        $this->addSql("ALTER TABLE event__mails ADD event_id INT DEFAULT NULL");
20
        $this->addSql("ALTER TABLE event__mails ADD CONSTRAINT FK_DBF9BBCB71F7E88B FOREIGN KEY (event_id) REFERENCES event__events(id) ON UPDATE CASCADE ON DELETE CASCADE");
21
        $this->addSql("CREATE INDEX IDX_DBF9BBCB71F7E88B ON event__mails (event_id)");
22
    }
23
24
    public function down(Schema $schema)
25
    {
26
        // this down() migration is autogenerated, please modify it to your needs
27
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");
28
        
29
        $this->addSql("CREATE TABLE event__events_mails (mail_id INT NOT NULL, event_id INT NOT NULL, INDEX IDX_ADE63A26C8776F01 (mail_id), INDEX IDX_ADE63A2671F7E88B (event_id), PRIMARY KEY(mail_id, event_id)) ENGINE = InnoDB");
30
        $this->addSql("ALTER TABLE event__events_mails ADD CONSTRAINT FK_ADE63A2671F7E88B FOREIGN KEY (event_id) REFERENCES event__events(id)");
31
        $this->addSql("ALTER TABLE event__events_mails ADD CONSTRAINT FK_ADE63A26C8776F01 FOREIGN KEY (mail_id) REFERENCES event__mails(id)");
32
        $this->addSql("ALTER TABLE event__mails DROP FOREIGN KEY FK_DBF9BBCB71F7E88B");
33
        $this->addSql("DROP INDEX IDX_DBF9BBCB71F7E88B ON event__mails");
34
        $this->addSql("ALTER TABLE event__mails DROP event_id");
35
    }
36
}
37