<?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 Version20230812132028 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 `option` (id INT AUTO_INCREMENT NOT NULL, parameter_id INT DEFAULT NULL, value VARCHAR(255) DEFAULT NULL, ip VARCHAR(255) DEFAULT NULL, created DATETIME DEFAULT NULL, changed DATETIME DEFAULT NULL, INDEX IDX_5A8600B07C56DBD6 (parameter_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE parameter (id INT AUTO_INCREMENT NOT NULL, code VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, type VARCHAR(20) NOT NULL, ip VARCHAR(255) DEFAULT NULL, product_type VARCHAR(32) DEFAULT NULL, sort_order INT DEFAULT NULL, created DATETIME DEFAULT NULL, changed DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE product_parameter (id INT AUTO_INCREMENT NOT NULL, value_option_id INT DEFAULT NULL, parameter_id INT NOT NULL, product_id INT DEFAULT NULL, value_number DOUBLE PRECISION DEFAULT NULL, value_text VARCHAR(255) DEFAULT NULL, value_rich LONGTEXT DEFAULT NULL, ip VARCHAR(255) DEFAULT NULL, created DATETIME DEFAULT NULL, changed DATETIME DEFAULT NULL, INDEX IDX_4437279DE25618D9 (value_option_id), INDEX IDX_4437279D7C56DBD6 (parameter_id), INDEX IDX_4437279D4584665A (product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE `option` ADD CONSTRAINT FK_5A8600B07C56DBD6 FOREIGN KEY (parameter_id) REFERENCES parameter (id)');
$this->addSql('ALTER TABLE product_parameter ADD CONSTRAINT FK_4437279DE25618D9 FOREIGN KEY (value_option_id) REFERENCES `option` (id)');
$this->addSql('ALTER TABLE product_parameter ADD CONSTRAINT FK_4437279D7C56DBD6 FOREIGN KEY (parameter_id) REFERENCES parameter (id)');
$this->addSql('ALTER TABLE product_parameter ADD CONSTRAINT FK_4437279D4584665A FOREIGN KEY (product_id) REFERENCES product (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE `option` DROP FOREIGN KEY FK_5A8600B07C56DBD6');
$this->addSql('ALTER TABLE product_parameter DROP FOREIGN KEY FK_4437279DE25618D9');
$this->addSql('ALTER TABLE product_parameter DROP FOREIGN KEY FK_4437279D7C56DBD6');
$this->addSql('ALTER TABLE product_parameter DROP FOREIGN KEY FK_4437279D4584665A');
$this->addSql('DROP TABLE `option`');
$this->addSql('DROP TABLE parameter');
$this->addSql('DROP TABLE product_parameter');
}
}