migrations/Version20220503164258.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 Version20220503164258 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 invoice_transaction_detail (id INT AUTO_INCREMENT NOT NULL, file_id INT DEFAULT NULL, reference VARCHAR(50) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', date DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_AEC1954393CB796C (file_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE invoice_transaction_detail ADD CONSTRAINT FK_AEC1954393CB796C FOREIGN KEY (file_id) REFERENCES File (id)');
  20.         $this->addSql('ALTER TABLE invoice_deposit ADD transaction_id INT DEFAULT NULL');
  21.         $this->addSql('ALTER TABLE invoice_deposit ADD CONSTRAINT FK_6702ABEA2FC0CB0F FOREIGN KEY (transaction_id) REFERENCES invoice_transaction_detail (id)');
  22.         $this->addSql('CREATE UNIQUE INDEX UNIQ_6702ABEA2FC0CB0F ON invoice_deposit (transaction_id)');
  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('ALTER TABLE invoice_deposit DROP FOREIGN KEY FK_6702ABEA2FC0CB0F');
  28.         $this->addSql('DROP TABLE invoice_transaction_detail');
  29.         $this->addSql('DROP INDEX UNIQ_6702ABEA2FC0CB0F ON invoice_deposit');
  30.         $this->addSql('ALTER TABLE invoice_deposit DROP transaction_id');
  31.     }
  32. }