migrations/2022/03/Version20220320222433.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 Version20220320222433 extends AbstractMigration
  7. {
  8.     public function up(Schema $schema): void
  9.     {
  10.         $this->addSql('CREATE TABLE connector_visma_accounting (id BINARY(16) NOT NULL COMMENT \'(DC2Type:connector_visma_accounting_id)\', contact_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:contact_id)\', last_sync_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', initialized TINYINT(1) NOT NULL, last_pulled_page INT NOT NULL, UNIQUE INDEX connector_visma_accounting_unique_id (contact_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  11.         $this->addSql('CREATE TABLE connector_visma_accounting_api_token (id BINARY(16) NOT NULL COMMENT \'(DC2Type:connector_visma_accounting_api_token_id)\', contact_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:contact_id)\', access_token LONGTEXT NOT NULL, refresh_token VARCHAR(255) NOT NULL, expires_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX connector_visma_accounting_api_token_unique_id (contact_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  12.         $this->addSql('ALTER TABLE connector_visma_accounting ADD CONSTRAINT FK_E6649464E7A1254A FOREIGN KEY (contact_id) REFERENCES contact (id)');
  13.         $this->addSql('ALTER TABLE connector_visma_accounting_api_token ADD CONSTRAINT FK_4D9ADEA2E7A1254A FOREIGN KEY (contact_id) REFERENCES contact (id)');
  14.         $this->addSql('ALTER TABLE contact_relationship_customer_supplier ADD customer_number VARCHAR(255) DEFAULT NULL');
  15.     }
  16.     public function down(Schema $schema): void
  17.     {
  18.         $this->addSql('DROP TABLE connector_visma_accounting');
  19.         $this->addSql('DROP TABLE connector_visma_accounting_api_token');
  20.         $this->addSql('ALTER TABLE contact_relationship_customer_supplier DROP customer_number');
  21.     }
  22. }