migrations/Version20190731162329.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 Version20190731162329 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  19.         $this->addSql('ALTER TABLE notification_send_receiver DROP FOREIGN KEY FK_C1D64375A6984895');
  20.         $this->addSql('CREATE TABLE notification (`id` INT AUTO_INCREMENT NOT NULL, `creation_date` DATETIME NOT NULL, `send_date` DATETIME DEFAULT NULL, `status` VARCHAR(255) NOT NULL COMMENT \'(DC2Type:notification_status)\', data VARCHAR(11000) NOT NULL, `info_response` VARCHAR(4000) DEFAULT NULL, PRIMARY KEY(`id`)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
  21.         $this->addSql('CREATE TABLE notification_receiver (`id` INT AUTO_INCREMENT NOT NULL, `token` VARCHAR(255) NOT NULL, `userId` VARCHAR(255) NOT NULL, `status_response` TINYINT(1) DEFAULT NULL, `status_message_response` VARCHAR(4000) DEFAULT NULL, `read` TINYINT(1) DEFAULT NULL, `notification_id` INT NOT NULL, INDEX IDX_68A8B433233B3E97 (`notification_id`), PRIMARY KEY(`id`)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
  22.         $this->addSql('ALTER TABLE notification_receiver ADD CONSTRAINT FK_68A8B433233B3E97 FOREIGN KEY (`notification_id`) REFERENCES notification (`id`) ON DELETE CASCADE');
  23.         $this->addSql('DROP TABLE notification_send');
  24.         $this->addSql('DROP TABLE notification_send_receiver');
  25.         $this->addSql('ALTER TABLE user_device CHANGE meta_data `meta_data` VARCHAR(4000) 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  31.         $this->addSql('ALTER TABLE notification_receiver DROP FOREIGN KEY FK_68A8B433233B3E97');
  32.         $this->addSql('CREATE TABLE notification_send (id INT AUTO_INCREMENT NOT NULL, data VARCHAR(11000) NOT NULL COLLATE utf8mb4_unicode_ci, send_date DATETIME NOT NULL, info_response VARCHAR(4000) DEFAULT NULL COLLATE utf8mb4_unicode_ci, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB COMMENT = \'\' ');
  33.         $this->addSql('CREATE TABLE notification_send_receiver (id INT AUTO_INCREMENT NOT NULL, notification_send_id INT NOT NULL, token VARCHAR(255) NOT NULL COLLATE utf8mb4_unicode_ci, userId VARCHAR(255) NOT NULL COLLATE utf8mb4_unicode_ci, status_response TINYINT(1) DEFAULT NULL, status_message_response VARCHAR(255) DEFAULT NULL COLLATE utf8mb4_general_ci, `read` TINYINT(1) DEFAULT NULL, INDEX IDX_C1D64375A6984895 (notification_send_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB COMMENT = \'\' ');
  34.         $this->addSql('ALTER TABLE notification_send_receiver ADD CONSTRAINT FK_C1D64375A6984895 FOREIGN KEY (notification_send_id) REFERENCES notification_send (id) ON DELETE CASCADE');
  35.         $this->addSql('DROP TABLE notification');
  36.         $this->addSql('DROP TABLE notification_receiver');
  37.         $this->addSql('ALTER TABLE user_device CHANGE `meta_data` meta_data VARCHAR(255) NOT NULL COLLATE utf8mb4_general_ci');
  38.     }
  39. }