Test Setup Failed
Push — master ( 14e042...222fdb )
by Artem
07:39 queued 05:58
created

Version20190318110040::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
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 Version20190318110040 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('DROP TABLE sponsor_translations');
22
        $this->addSql('ALTER TABLE sponsors DROP slug, DROP about, DROP on_main');
23
    }
24
25
    /**
26
     * @param Schema $schema
27
     */
28
    public function down(Schema $schema)
29
    {
30
        // this down() migration is auto-generated, please modify it to your needs
31
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
32
33
        $this->addSql('CREATE TABLE sponsor_translations (id INT AUTO_INCREMENT NOT NULL, object_id INT DEFAULT NULL, locale VARCHAR(8) NOT NULL COLLATE utf8_unicode_ci, field VARCHAR(32) NOT NULL COLLATE utf8_unicode_ci, content LONGTEXT DEFAULT NULL COLLATE utf8_unicode_ci, UNIQUE INDEX sponsor_lookup_unique_idx (locale, object_id, field), INDEX IDX_4C84E738232D562B (object_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
34
        $this->addSql('ALTER TABLE sponsor_translations ADD CONSTRAINT FK_4C84E738232D562B FOREIGN KEY (object_id) REFERENCES sponsors (id) ON DELETE CASCADE');
35
        $this->addSql('ALTER TABLE sponsors ADD slug VARCHAR(255) NOT NULL COLLATE utf8_general_ci, ADD about LONGTEXT DEFAULT NULL COLLATE utf8_general_ci, ADD on_main TINYINT(1) NOT NULL');
36
    }
37
}
38