<?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 Version20220802115310 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 category (id VARCHAR(255) NOT NULL, name VARCHAR(80) NOT NULL, slug VARCHAR(80) NOT NULL, name_alt VARCHAR(80) DEFAULT NULL, slug_alt VARCHAR(80) DEFAULT NULL, woo_commerce_id INT DEFAULT NULL, woo_commerce_id_alt INT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE product DROP FOREIGN KEY FK_D34A04AD12469DE2');
$this->addSql('ALTER TABLE product ADD category_id VARCHAR(255) DEFAULT NULL, ADD sale_price DOUBLE PRECISION DEFAULT NULL, ADD featured TINYINT(1) NOT NULL');
$this->addSql('ALTER TABLE product ADD CONSTRAINT FK_D34A04AD12469DE2 FOREIGN KEY (category_id) REFERENCES category (id)');
$this->addSql('CREATE INDEX IDX_D34A04AD12469DE2 ON product (category_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE product DROP FOREIGN KEY FK_D34A04AD12469DE2');
$this->addSql('DROP TABLE category');
$this->addSql('ALTER TABLE product DROP FOREIGN KEY FK_D34A04AD44F5D008');
$this->addSql('ALTER TABLE product DROP FOREIGN KEY FK_D34A04AD12469DE2');
$this->addSql('DROP INDEX IDX_D34A04AD12469DE2 ON product');
$this->addSql('ALTER TABLE product DROP category_id, DROP sale_price, DROP featured');
$this->addSql('ALTER TABLE product ADD CONSTRAINT FK_D34A04AD12469DE2 FOREIGN KEY (brand_id) REFERENCES brand (id)');
}
}