migrations/Version20250518190009.php line 1

Open in your IDE?
  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 Version20250518190009 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('CREATE TABLE 360_view (id INT AUTO_INCREMENT NOT NULL, image_extension VARCHAR(255) NOT NULL, created DATETIME NOT NULL, creator VARCHAR(255) NOT NULL, modified DATETIME NOT NULL, modified_by VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19. $this->addSql('CREATE TABLE three_sixty_view_image (three_sixty_view_id INT NOT NULL, image_id INT NOT NULL, INDEX IDX_F1735398F7B0A1B (three_sixty_view_id), INDEX IDX_F17353983DA5256D (image_id), PRIMARY KEY(three_sixty_view_id, image_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20. $this->addSql('ALTER TABLE three_sixty_view_image ADD CONSTRAINT FK_F1735398F7B0A1B FOREIGN KEY (three_sixty_view_id) REFERENCES 360_view (id) ON DELETE CASCADE');
  21. $this->addSql('ALTER TABLE three_sixty_view_image ADD CONSTRAINT FK_F17353983DA5256D FOREIGN KEY (image_id) REFERENCES image (id) ON DELETE CASCADE');
  22. $this->addSql('ALTER TABLE product ADD three_sixty_view_id INT DEFAULT NULL');
  23. $this->addSql('ALTER TABLE product ADD CONSTRAINT FK_D34A04ADF7B0A1B FOREIGN KEY (three_sixty_view_id) REFERENCES 360_view (id)');
  24. $this->addSql('CREATE UNIQUE INDEX UNIQ_D34A04ADF7B0A1B ON product (three_sixty_view_id)');
  25. }
  26. public function down(Schema $schema): void
  27. {
  28. // this down() migration is auto-generated, please modify it to your needs
  29. $this->addSql('ALTER TABLE product DROP FOREIGN KEY FK_D34A04ADF7B0A1B');
  30. $this->addSql('ALTER TABLE three_sixty_view_image DROP FOREIGN KEY FK_F1735398F7B0A1B');
  31. $this->addSql('ALTER TABLE three_sixty_view_image DROP FOREIGN KEY FK_F17353983DA5256D');
  32. $this->addSql('DROP TABLE 360_view');
  33. $this->addSql('DROP TABLE three_sixty_view_image');
  34. $this->addSql('DROP INDEX UNIQ_D34A04ADF7B0A1B ON product');
  35. $this->addSql('ALTER TABLE product DROP three_sixty_view_id');
  36. }
  37. }