Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

50 lines
2.5KB

  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 Version20210603090526 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 DROP FOREIGN KEY FK_140AB620727ACA70');
  19. $this->addSql('DROP INDEX IDX_140AB620727ACA70 ON page');
  20. $this->addSql('ALTER TABLE page ADD merchant_id INT NOT NULL, ADD content LONGTEXT DEFAULT NULL, ADD section_id INT DEFAULT NULL');
  21. $this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB6206796D554 FOREIGN KEY (merchant_id) REFERENCES merchant (id)');
  22. $this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB620D823E37A FOREIGN KEY (section_id) REFERENCES section (id)');
  23. $this->addSql('CREATE INDEX IDX_140AB6206796D554 ON page (merchant_id)');
  24. $this->addSql('CREATE INDEX IDX_140AB620D823E37A ON page (section_id)');
  25. $this->addSql('ALTER TABLE user_merchant ADD current_admin_section_id INT DEFAULT NULL');
  26. $this->addSql('ALTER TABLE user_merchant ADD CONSTRAINT FK_9426C1E1FE54D809 FOREIGN KEY (current_admin_section_id) REFERENCES section (id)');
  27. $this->addSql('CREATE INDEX IDX_9426C1E1FE54D809 ON user_merchant (current_admin_section_id)');
  28. }
  29. public function down(Schema $schema): void
  30. {
  31. // this down() migration is auto-generated, please modify it to your needs
  32. $this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB6206796D554');
  33. $this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB620D823E37A');
  34. $this->addSql('DROP INDEX IDX_140AB6206796D554 ON page');
  35. $this->addSql('DROP INDEX IDX_140AB620D823E37A ON page');
  36. $this->addSql('ALTER TABLE page DROP merchant_id, DROP content, CHANGE section_id parent_id INT DEFAULT NULL');
  37. $this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB620727ACA70 FOREIGN KEY (parent_id) REFERENCES page (id)');
  38. $this->addSql('CREATE INDEX IDX_140AB620727ACA70 ON page (parent_id)');
  39. $this->addSql('ALTER TABLE user_merchant DROP FOREIGN KEY FK_9426C1E1FE54D809');
  40. $this->addSql('DROP INDEX IDX_9426C1E1FE54D809 ON user_merchant');
  41. $this->addSql('ALTER TABLE user_merchant DROP current_admin_section_id');
  42. }
  43. }