Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d5fb403

Browse files
committed
Add migration from Sylius/Sylius#11012
1 parent 8f35189 commit d5fb403

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Sylius package.
5+
*
6+
* (c) Paweł Jędrzejewski
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace Sylius\Migrations;
15+
16+
use Doctrine\DBAL\Schema\Schema;
17+
use Doctrine\Migrations\AbstractMigration;
18+
19+
final class Version20200110132702 extends AbstractMigration
20+
{
21+
public function up(Schema $schema): void
22+
{
23+
// this up() migration is auto-generated, please modify it to your needs
24+
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
25+
26+
$this->addSql('ALTER TABLE sylius_channel ADD menu_taxon_id INT DEFAULT NULL');
27+
$this->addSql('ALTER TABLE sylius_channel ADD CONSTRAINT FK_16C8119EF242B1E6 FOREIGN KEY (menu_taxon_id) REFERENCES sylius_taxon (id) ON DELETE SET NULL');
28+
$this->addSql('CREATE INDEX IDX_16C8119EF242B1E6 ON sylius_channel (menu_taxon_id)');
29+
}
30+
31+
public function down(Schema $schema): void
32+
{
33+
// this down() migration is auto-generated, please modify it to your needs
34+
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
35+
36+
$this->addSql('ALTER TABLE sylius_channel DROP FOREIGN KEY FK_16C8119EF242B1E6');
37+
$this->addSql('DROP INDEX IDX_16C8119EF242B1E6 ON sylius_channel');
38+
$this->addSql('ALTER TABLE sylius_channel DROP menu_taxon_id');
39+
}
40+
}

0 commit comments

Comments
 (0)