Total Complexity | 2 |
Total Lines | 25 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
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 | } |
||
38 |