<?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 Version20220815124504 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 TABLE bookkeeping__sberbank_acquiring_orders (id INT AUTO_INCREMENT NOT NULL, order_id INT NOT NULL, created_at DATETIME NOT NULL, status VARCHAR(255) NOT NULL, type VARCHAR(255) DEFAULT NULL, acquiring_order VARCHAR(255) DEFAULT NULL, form_url VARCHAR(255) DEFAULT NULL, auth_code VARCHAR(255) DEFAULT NULL, operation_id VARCHAR(255) DEFAULT NULL, amount INT NOT NULL, refund_amount INT DEFAULT 0 NOT NULL, error LONGTEXT DEFAULT NULL, webhook_request LONGTEXT DEFAULT NULL, INDEX IDX_6F83AD3D8D9F6D38 (order_id), INDEX created_at (created_at), INDEX status (status), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE bookkeeping__sberbank_acquiring_orders_products (id INT AUTO_INCREMENT NOT NULL, sberbank_acquiring_order_id INT DEFAULT NULL, product_id INT DEFAULT NULL, created_at DATETIME NOT NULL, quantity INT NOT NULL, amount INT NOT NULL, refund_amount INT DEFAULT 0 NOT NULL, INDEX IDX_33108702C6DB15B5 (sberbank_acquiring_order_id), INDEX IDX_331087024584665A (product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE bookkeeping__sberbank_acquiring_orders ADD CONSTRAINT FK_6F83AD3D8D9F6D38 FOREIGN KEY (order_id) REFERENCES orders__orders (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE bookkeeping__sberbank_acquiring_orders_products ADD CONSTRAINT FK_33108702C6DB15B5 FOREIGN KEY (sberbank_acquiring_order_id) REFERENCES bookkeeping__sberbank_acquiring_orders (id)');
$this->addSql('ALTER TABLE bookkeeping__sberbank_acquiring_orders_products ADD CONSTRAINT FK_331087024584665A FOREIGN KEY (product_id) REFERENCES products__products (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE bookkeeping__sberbank_acquiring_orders_products DROP FOREIGN KEY FK_33108702C6DB15B5');
$this->addSql('DROP TABLE bookkeeping__sberbank_acquiring_orders');
$this->addSql('DROP TABLE bookkeeping__sberbank_acquiring_orders_products');
}
}