<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220511143933 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SEQUENCE sepa_sddr_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE transactions_errors_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$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))');
$this->addSql('CREATE INDEX IDX_AB61C392712520F3 ON sepa_sddr (wallet_id)');
$this->addSql('CREATE INDEX IDX_AB61C392ECCAAFA0 ON sepa_sddr (beneficiary_id)');
$this->addSql('CREATE INDEX IDX_AB61C3926C1129CD ON sepa_sddr (mandate_id)');
$this->addSql('ALTER TABLE sepa_sddr ADD CONSTRAINT FK_AB61C392712520F3 FOREIGN KEY (wallet_id) REFERENCES wallet (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE sepa_sddr ADD CONSTRAINT FK_AB61C392ECCAAFA0 FOREIGN KEY (beneficiary_id) REFERENCES beneficiaries (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE sepa_sddr ADD CONSTRAINT FK_AB61C3926C1129CD FOREIGN KEY (mandate_id) REFERENCES mandates (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE sepa_sddr_id_seq CASCADE');
$this->addSql('DROP SEQUENCE transactions_errors_id_seq CASCADE');
$this->addSql('DROP TABLE sepa_sddr');
}
}