migrations/Version20230214160626.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 Version20230214160626 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 notification (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, body LONGTEXT DEFAULT NULL, level VARCHAR(30) DEFAULT NULL, send_email TINYINT(1) DEFAULT NULL, targets LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', valid_from DATETIME NOT NULL, valid_to DATETIME NOT NULL, status SMALLINT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19. $this->addSql('CREATE TABLE notification_customer (notification_id INT NOT NULL, customer_id INT NOT NULL, INDEX IDX_D429B6ACEF1A9D84 (notification_id), INDEX IDX_D429B6AC9395C3F3 (customer_id), PRIMARY KEY(notification_id, customer_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20. $this->addSql('CREATE TABLE notification_user_consent (notification_id INT NOT NULL, user_consent_id INT NOT NULL, INDEX IDX_3A11FC2FEF1A9D84 (notification_id), INDEX IDX_3A11FC2FE6605B8F (user_consent_id), PRIMARY KEY(notification_id, user_consent_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21. $this->addSql('ALTER TABLE notification_customer ADD CONSTRAINT FK_D429B6ACEF1A9D84 FOREIGN KEY (notification_id) REFERENCES notification (id) ON DELETE CASCADE');
  22. $this->addSql('ALTER TABLE notification_customer ADD CONSTRAINT FK_D429B6AC9395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id) ON DELETE CASCADE');
  23. $this->addSql('ALTER TABLE notification_user_consent ADD CONSTRAINT FK_3A11FC2FEF1A9D84 FOREIGN KEY (notification_id) REFERENCES notification (id) ON DELETE CASCADE');
  24. $this->addSql('ALTER TABLE notification_user_consent ADD CONSTRAINT FK_3A11FC2FE6605B8F FOREIGN KEY (user_consent_id) REFERENCES user_consent (id) ON DELETE CASCADE');
  25. $this->addSql('ALTER TABLE user_consent ADD last_login DATETIME DEFAULT NULL, ADD google_id VARCHAR(50) NOT NULL');
  26. }
  27. public function down(Schema $schema): void
  28. {
  29. // this down() migration is auto-generated, please modify it to your needs
  30. $this->addSql('ALTER TABLE notification_customer DROP FOREIGN KEY FK_D429B6ACEF1A9D84');
  31. $this->addSql('ALTER TABLE notification_user_consent DROP FOREIGN KEY FK_3A11FC2FEF1A9D84');
  32. $this->addSql('DROP TABLE notification');
  33. $this->addSql('DROP TABLE notification_customer');
  34. $this->addSql('DROP TABLE notification_user_consent');
  35. $this->addSql('ALTER TABLE user_consent DROP last_login, DROP google_id');
  36. }
  37. }