You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Version20210603142706.php 2.8KB

преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
преди 3 години
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7. * Auto-generated Migration: Please modify to your needs!
  8. */
  9. final class Version20210603142706 extends AbstractMigration
  10. {
  11. public function getDescription(): string
  12. {
  13. return '';
  14. }
  15. public function up(Schema $schema): void
  16. {
  17. // this up() migration is auto-generated, please modify it to your needs
  18. $this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB6206796D554 FOREIGN KEY (merchant_id) REFERENCES merchant (id)');
  19. $this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB620D823E37A FOREIGN KEY (section_id) REFERENCES section (id)');
  20. $this->addSql('CREATE INDEX IDX_140AB6206796D554 ON page (merchant_id)');
  21. $this->addSql('CREATE INDEX IDX_140AB620D823E37A ON page (section_id)');
  22. $this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D6496796D554');
  23. $this->addSql('DROP INDEX IDX_8D93D6496796D554 ON user');
  24. $this->addSql('ALTER TABLE user CHANGE merchant_id favorite_merchant_id INT DEFAULT NULL');
  25. $this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D649A4849017 FOREIGN KEY (favorite_merchant_id) REFERENCES merchant (id)');
  26. $this->addSql('CREATE INDEX IDX_8D93D649A4849017 ON user (favorite_merchant_id)');
  27. $this->addSql('ALTER TABLE user_merchant ADD current_admin_section_id INT DEFAULT NULL');
  28. $this->addSql('ALTER TABLE user_merchant ADD CONSTRAINT FK_9426C1E1FE54D809 FOREIGN KEY (current_admin_section_id) REFERENCES section (id)');
  29. $this->addSql('CREATE INDEX IDX_9426C1E1FE54D809 ON user_merchant (current_admin_section_id)');
  30. }
  31. public function down(Schema $schema): void
  32. {
  33. // this down() migration is auto-generated, please modify it to your needs
  34. $this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB6206796D554');
  35. $this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB620D823E37A');
  36. $this->addSql('DROP INDEX IDX_140AB6206796D554 ON page');
  37. $this->addSql('DROP INDEX IDX_140AB620D823E37A ON page');
  38. $this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D649A4849017');
  39. $this->addSql('DROP INDEX IDX_8D93D649A4849017 ON user');
  40. $this->addSql('ALTER TABLE user CHANGE favorite_merchant_id merchant_id INT DEFAULT NULL');
  41. $this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D6496796D554 FOREIGN KEY (merchant_id) REFERENCES merchant (id)');
  42. $this->addSql('CREATE INDEX IDX_8D93D6496796D554 ON user (merchant_id)');
  43. $this->addSql('ALTER TABLE user_merchant DROP FOREIGN KEY FK_9426C1E1FE54D809');
  44. $this->addSql('DROP INDEX IDX_9426C1E1FE54D809 ON user_merchant');
  45. $this->addSql('ALTER TABLE user_merchant DROP current_admin_section_id');
  46. }
  47. }