File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments