<?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 Version20211216092042 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 payment_provider (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, image_path VARCHAR(255) DEFAULT NULL, active TINYINT(1) DEFAULT \'1\' NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE products_payment_providers (product_id INT NOT NULL, payment_provider_id INT NOT NULL, INDEX IDX_5932AED04584665A (product_id), INDEX IDX_5932AED0FCDF7870 (payment_provider_id), PRIMARY KEY(product_id, payment_provider_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE products_shipping_providers (product_id INT NOT NULL, shipping_provider_id INT NOT NULL, INDEX IDX_949D449C4584665A (product_id), INDEX IDX_949D449C86382F09 (shipping_provider_id), PRIMARY KEY(product_id, shipping_provider_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE shipping_provider (id INT AUTO_INCREMENT NOT NULL, country_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, image_path VARCHAR(255) DEFAULT NULL, active TINYINT(1) DEFAULT \'1\' NOT NULL, INDEX IDX_E2B3D33F92F3E70 (country_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE products_payment_providers ADD CONSTRAINT FK_5932AED04584665A FOREIGN KEY (product_id) REFERENCES product (id)');
$this->addSql('ALTER TABLE products_payment_providers ADD CONSTRAINT FK_5932AED0FCDF7870 FOREIGN KEY (payment_provider_id) REFERENCES payment_provider (id)');
$this->addSql('ALTER TABLE products_shipping_providers ADD CONSTRAINT FK_949D449C4584665A FOREIGN KEY (product_id) REFERENCES product (id)');
$this->addSql('ALTER TABLE products_shipping_providers ADD CONSTRAINT FK_949D449C86382F09 FOREIGN KEY (shipping_provider_id) REFERENCES shipping_provider (id)');
$this->addSql('ALTER TABLE shipping_provider ADD CONSTRAINT FK_E2B3D33F92F3E70 FOREIGN KEY (country_id) REFERENCES country (id)');
$this->addSql('ALTER TABLE domain_vat CHANGE id id INT AUTO_INCREMENT NOT NULL');
$this->addSql('ALTER TABLE image CHANGE active active TINYINT(1) NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE products_payment_providers DROP FOREIGN KEY FK_5932AED0FCDF7870');
$this->addSql('ALTER TABLE products_shipping_providers DROP FOREIGN KEY FK_949D449C86382F09');
$this->addSql('DROP TABLE payment_provider');
$this->addSql('DROP TABLE products_payment_providers');
$this->addSql('DROP TABLE products_shipping_providers');
$this->addSql('DROP TABLE shipping_provider');
$this->addSql('ALTER TABLE domain_vat CHANGE id id VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`');
$this->addSql('ALTER TABLE image CHANGE active active TINYINT(1) NOT NULL');
}
}