<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20190731162329 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE notification_send_receiver DROP FOREIGN KEY FK_C1D64375A6984895');
$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');
$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');
$this->addSql('ALTER TABLE notification_receiver ADD CONSTRAINT FK_68A8B433233B3E97 FOREIGN KEY (`notification_id`) REFERENCES notification (`id`) ON DELETE CASCADE');
$this->addSql('DROP TABLE notification_send');
$this->addSql('DROP TABLE notification_send_receiver');
$this->addSql('ALTER TABLE user_device CHANGE meta_data `meta_data` VARCHAR(4000) NOT NULL');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE notification_receiver DROP FOREIGN KEY FK_68A8B433233B3E97');
$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 = \'\' ');
$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 = \'\' ');
$this->addSql('ALTER TABLE notification_send_receiver ADD CONSTRAINT FK_C1D64375A6984895 FOREIGN KEY (notification_send_id) REFERENCES notification_send (id) ON DELETE CASCADE');
$this->addSql('DROP TABLE notification');
$this->addSql('DROP TABLE notification_receiver');
$this->addSql('ALTER TABLE user_device CHANGE `meta_data` meta_data VARCHAR(255) NOT NULL COLLATE utf8mb4_general_ci');
}
}