vendor/plna-penezenka/pp-sdk-bundle/migrations/Version20220323003431_SMSDeliveryRequests.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace PPSDKDoctrineMigrations;
  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 Version20220323003431_SMSDeliveryRequests 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 sms_delivery_requests (id INT AUTO_INCREMENT NOT NULL, notification_definition_id INT DEFAULT NULL, user_id INT DEFAULT NULL, priority INT NOT NULL, phone_number VARCHAR(24) NOT NULL, message LONGTEXT NOT NULL, deliver_when DATETIME NOT NULL, abort_if_not_processed_when DATETIME DEFAULT NULL, delivery_status VARCHAR(16) NOT NULL, delivery_status_changed_when DATETIME DEFAULT NULL, delivery_status_comment LONGTEXT NOT NULL, created_when DATETIME NOT NULL, updated_when DATETIME NOT NULL, INDEX IDX_E140A21287AC63D8 (notification_definition_id), INDEX IDX_E140A212A76ED395 (user_id), INDEX delivery_plan (delivery_status, deliver_when, priority), INDEX abort_when (delivery_status, abort_if_not_processed_when), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE sms_delivery_requests ADD CONSTRAINT FK_E140A21287AC63D8 FOREIGN KEY (notification_definition_id) REFERENCES sms_notification_definitions (id)');
  20.         $this->addSql('ALTER TABLE sms_delivery_requests ADD CONSTRAINT FK_E140A212A76ED395 FOREIGN KEY (user_id) REFERENCES users (id)');
  21.         $this->addSql('ALTER TABLE sms_notification_definitions ADD delivery_can_continue_next_day TINYINT(1) DEFAULT 1 NOT NULL, ADD status_changed_when DATETIME DEFAULT NULL, ADD recipients LONGTEXT NOT NULL');
  22.         $this->addSql("UPDATE sms_notification_definitions SET recipients = '' WHERE recipients IS NULL");
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         // this down() migration is auto-generated, please modify it to your needs
  27.         $this->addSql('DROP TABLE sms_delivery_requests');
  28.         $this->addSql('ALTER TABLE sms_notification_definitions DROP delivery_can_continue_next_day, DROP status_changed_when, DROP recipients');
  29.     }
  30. }