migrations/2020/11/Version20201123230539.php line 1

  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. final class Version20201123230539 extends AbstractMigration
  7. {
  8.     public function up(Schema $schema): void
  9.     {
  10.         $this->addSql('CREATE TABLE invoice_draft_email (id BINARY(16) NOT NULL COMMENT \'(DC2Type:invoice_draft_email_id)\', created_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid_binary_ordered_time)\', invoice_draft_id BINARY(16) NOT NULL COMMENT \'(DC2Type:invoice_draft_id)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', sent_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', recipients LONGTEXT NOT NULL COMMENT \'(DC2Type:simple_array)\', recipients_cc LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:simple_array)\', recipients_bcc LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:simple_array)\', message LONGTEXT NOT NULL, INDEX IDX_F7AB9A68B03A8386 (created_by_id), INDEX IDX_F7AB9A68FDDB9F89 (invoice_draft_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  11.         $this->addSql('CREATE TABLE invoice_draft_email_attachment (id BINARY(16) NOT NULL COMMENT \'(DC2Type:invoice_draft_email_attachment_id)\', email_id BINARY(16) NOT NULL COMMENT \'(DC2Type:invoice_draft_email_id)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', filename VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, INDEX IDX_B5D547FCA832C1C9 (email_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  12.         $this->addSql('CREATE TABLE invoice_draft_email_draft (id BINARY(16) NOT NULL COMMENT \'(DC2Type:invoice_draft_email_draft_id)\', created_by_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid_binary_ordered_time)\', invoice_draft_id BINARY(16) NOT NULL COMMENT \'(DC2Type:invoice_draft_id)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', recipients LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:simple_array)\', recipients_cc LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:simple_array)\', recipients_bcc LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:simple_array)\', message LONGTEXT DEFAULT NULL, INDEX IDX_99B433DFB03A8386 (created_by_id), INDEX IDX_99B433DFFDDB9F89 (invoice_draft_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  13.         $this->addSql('CREATE TABLE invoice_draft_email_draft_attachment (id BINARY(16) NOT NULL COMMENT \'(DC2Type:invoice_draft_email_draft_attachment_id)\', email_draft_id BINARY(16) NOT NULL COMMENT \'(DC2Type:invoice_draft_email_draft_id)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', filename VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, INDEX IDX_203032CEE995DA98 (email_draft_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  14.         $this->addSql('ALTER TABLE invoice_draft_email ADD CONSTRAINT FK_F7AB9A68B03A8386 FOREIGN KEY (created_by_id) REFERENCES contact (id)');
  15.         $this->addSql('ALTER TABLE invoice_draft_email ADD CONSTRAINT FK_F7AB9A68FDDB9F89 FOREIGN KEY (invoice_draft_id) REFERENCES invoice_draft (id)');
  16.         $this->addSql('ALTER TABLE invoice_draft_email_attachment ADD CONSTRAINT FK_B5D547FCA832C1C9 FOREIGN KEY (email_id) REFERENCES invoice_draft_email (id)');
  17.         $this->addSql('ALTER TABLE invoice_draft_email_draft ADD CONSTRAINT FK_99B433DFB03A8386 FOREIGN KEY (created_by_id) REFERENCES contact (id)');
  18.         $this->addSql('ALTER TABLE invoice_draft_email_draft ADD CONSTRAINT FK_99B433DFFDDB9F89 FOREIGN KEY (invoice_draft_id) REFERENCES invoice_draft (id)');
  19.         $this->addSql('ALTER TABLE invoice_draft_email_draft_attachment ADD CONSTRAINT FK_203032CEE995DA98 FOREIGN KEY (email_draft_id) REFERENCES invoice_draft_email_draft (id)');
  20.         $this->addSql('ALTER TABLE invoice_draft ADD deleted_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid_binary_ordered_time)\', ADD deleted_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\'');
  21.         $this->addSql('ALTER TABLE invoice_draft ADD CONSTRAINT FK_7BA6C621C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES contact (id)');
  22.         $this->addSql('CREATE INDEX IDX_7BA6C621C76F1F52 ON invoice_draft (deleted_by_id)');
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         $this->addSql('ALTER TABLE invoice_draft_email_attachment DROP FOREIGN KEY FK_B5D547FCA832C1C9');
  27.         $this->addSql('ALTER TABLE invoice_draft_email_draft_attachment DROP FOREIGN KEY FK_203032CEE995DA98');
  28.         $this->addSql('DROP TABLE invoice_draft_email');
  29.         $this->addSql('DROP TABLE invoice_draft_email_attachment');
  30.         $this->addSql('DROP TABLE invoice_draft_email_draft');
  31.         $this->addSql('DROP TABLE invoice_draft_email_draft_attachment');
  32.         $this->addSql('ALTER TABLE invoice_draft DROP FOREIGN KEY FK_7BA6C621C76F1F52');
  33.         $this->addSql('DROP INDEX IDX_7BA6C621C76F1F52 ON invoice_draft');
  34.         $this->addSql('ALTER TABLE invoice_draft DROP deleted_by_id, DROP deleted_at');
  35.     }
  36. }