vendor/plna-penezenka/pp-sdk-bundle/migrations/Version20220223204121_Payments.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace PPSDKDoctrineMigrations;
  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 Version20220223204121_Payments extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'Adds Payment entity and payment logic columns';
  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 IF NOT EXISTS payments (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, payment_request_id INT DEFAULT NULL, bank_code VARCHAR(24) NOT NULL, sender_account VARCHAR(32) NOT NULL, recipient_account VARCHAR(64) NOT NULL, amount DOUBLE PRECISION NOT NULL, currency VARCHAR(3) NOT NULL, variable_symbol VARCHAR(10) NOT NULL, specific_symbol VARCHAR(10) NOT NULL, constant_symbol VARCHAR(4) NOT NULL, recipient_message VARCHAR(140) NOT NULL, comment VARCHAR(255) NOT NULL, due_date DATE NOT NULL, status VARCHAR(32) NOT NULL, type VARCHAR(32) NOT NULL, executed_when DATETIME DEFAULT NULL, exception_class VARCHAR(255) NOT NULL, exception_message LONGTEXT NOT NULL, exception_trace LONGTEXT NOT NULL, created_when DATETIME NOT NULL, updated_when DATETIME NOT NULL, fio_batch_id VARCHAR(255) NOT NULL, fio_status VARCHAR(40) NOT NULL, fio_error_code INT NOT NULL, fio_api_endpoint_url VARCHAR(255) NOT NULL, fio_request_xml LONGTEXT NOT NULL, fio_response_body LONGTEXT NOT NULL, fio_http_response_code INT NOT NULL, fio_sent_to_api_when DATETIME DEFAULT NULL, INDEX IDX_65D29B32A76ED395 (user_id), INDEX IDX_65D29B3277883970 (payment_request_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE payments ADD CONSTRAINT FK_65D29B32A76ED395 FOREIGN KEY (user_id) REFERENCES users (id)');
  20.         $this->addSql('ALTER TABLE payments ADD CONSTRAINT FK_65D29B3277883970 FOREIGN KEY (payment_request_id) REFERENCES payment_requests (id)');
  21.         $this->addSql('ALTER TABLE payment_requests ADD after_payment_email_scheduled_when DATETIME DEFAULT NULL, ADD after_payment_email_sent_when DATETIME DEFAULT NULL');
  22.     }
  23.     public function down(Schema $schema): void
  24.     {
  25.         // this down() migration is auto-generated, please modify it to your needs
  26.         // $this->addSql('DROP TABLE payments');
  27.         $this->addSql('ALTER TABLE payment_requests DROP after_payment_email_scheduled_when, DROP after_payment_email_sent_when');
  28.     }
  29. }