<?php
declare(strict_types=1);
namespace PPSDKDoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220223204121_Payments extends AbstractMigration
{
public function getDescription(): string
{
return 'Adds Payment entity and payment logic columns';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$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');
$this->addSql('ALTER TABLE payments ADD CONSTRAINT FK_65D29B32A76ED395 FOREIGN KEY (user_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE payments ADD CONSTRAINT FK_65D29B3277883970 FOREIGN KEY (payment_request_id) REFERENCES payment_requests (id)');
$this->addSql('ALTER TABLE payment_requests ADD after_payment_email_scheduled_when DATETIME DEFAULT NULL, ADD after_payment_email_sent_when DATETIME DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
// $this->addSql('DROP TABLE payments');
$this->addSql('ALTER TABLE payment_requests DROP after_payment_email_scheduled_when, DROP after_payment_email_sent_when');
}
}