migrations/Version20220511143933.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 Version20220511143933 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 SEQUENCE sepa_sddr_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  19.         $this->addSql('CREATE SEQUENCE transactions_errors_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  20.         $this->addSql('CREATE TABLE sepa_sddr (id INT NOT NULL, wallet_id INT NOT NULL, beneficiary_id INT NOT NULL, mandate_id INT DEFAULT NULL, sepa_sddr_id INT NOT NULL, virtual_iban_id INT DEFAULT NULL, transaction_id INT NOT NULL, interbank_settlement_amount DOUBLE PRECISION NOT NULL, requested_collection_date JSON DEFAULT NULL, local_instrument VARCHAR(255) NOT NULL, creditor_scheme_id VARCHAR(255) DEFAULT NULL, debtor_name VARCHAR(255) DEFAULT NULL, debtor_address VARCHAR(255) DEFAULT NULL, debtor_country VARCHAR(255) DEFAULT NULL, creditor_name VARCHAR(255) DEFAULT NULL, creditor_address VARCHAR(255) DEFAULT NULL, creditor_country VARCHAR(255) DEFAULT NULL, creditor_bic VARCHAR(255) DEFAULT NULL, creditor_iban VARCHAR(255) DEFAULT NULL, unstructured_field VARCHAR(255) DEFAULT NULL, created_date JSON DEFAULT NULL, PRIMARY KEY(id))');
  21.         $this->addSql('CREATE INDEX IDX_AB61C392712520F3 ON sepa_sddr (wallet_id)');
  22.         $this->addSql('CREATE INDEX IDX_AB61C392ECCAAFA0 ON sepa_sddr (beneficiary_id)');
  23.         $this->addSql('CREATE INDEX IDX_AB61C3926C1129CD ON sepa_sddr (mandate_id)');
  24.         $this->addSql('ALTER TABLE sepa_sddr ADD CONSTRAINT FK_AB61C392712520F3 FOREIGN KEY (wallet_id) REFERENCES wallet (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  25.         $this->addSql('ALTER TABLE sepa_sddr ADD CONSTRAINT FK_AB61C392ECCAAFA0 FOREIGN KEY (beneficiary_id) REFERENCES beneficiaries (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  26.         $this->addSql('ALTER TABLE sepa_sddr ADD CONSTRAINT FK_AB61C3926C1129CD FOREIGN KEY (mandate_id) REFERENCES mandates (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  27.     }
  28.     public function down(Schema $schema): void
  29.     {
  30.         // this down() migration is auto-generated, please modify it to your needs
  31.         $this->addSql('CREATE SCHEMA public');
  32.         $this->addSql('DROP SEQUENCE sepa_sddr_id_seq CASCADE');
  33.         $this->addSql('DROP SEQUENCE transactions_errors_id_seq CASCADE');
  34.         $this->addSql('DROP TABLE sepa_sddr');
  35.     }
  36. }