<?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 Version20220629232419 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 color (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE emails (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE feedback (id INT AUTO_INCREMENT NOT NULL, subject VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, message LONGTEXT NOT NULL, viewed TINYINT(1) NOT NULL, sent TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE office (id INT AUTO_INCREMENT NOT NULL, city VARCHAR(255) NOT NULL, street VARCHAR(255) DEFAULT NULL, type VARCHAR(255) NOT NULL, postcode VARCHAR(255) DEFAULT NULL, latitude VARCHAR(255) NOT NULL, longitude VARCHAR(255) NOT NULL, phone VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, utc VARCHAR(255) DEFAULT NULL, working_time VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE product (id INT AUTO_INCREMENT NOT NULL, product_category_id INT DEFAULT NULL, product_type_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, title_detail VARCHAR(255) NOT NULL, sort VARCHAR(45) NOT NULL, public TINYINT(1) NOT NULL, preview VARCHAR(45) NOT NULL, description LONGTEXT NOT NULL, features LONGTEXT NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', duration VARCHAR(45) NOT NULL, is_popular TINYINT(1) NOT NULL, label VARCHAR(45) NOT NULL, label_type INT NOT NULL, INDEX IDX_D34A04ADBE6903FD (product_category_id), INDEX IDX_D34A04AD14959723 (product_type_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE product_article (id INT AUTO_INCREMENT NOT NULL, product_id INT DEFAULT NULL, title VARCHAR(45) NOT NULL, link VARCHAR(45) NOT NULL, code VARCHAR(45) NOT NULL, description LONGTEXT NOT NULL, INDEX IDX_D3E315D64584665A (product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE product_category (id INT AUTO_INCREMENT NOT NULL, product_category_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, public TINYINT(1) NOT NULL, INDEX IDX_CDFC7356BE6903FD (product_category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE product_category_type (id INT AUTO_INCREMENT NOT NULL, product_category_id INT DEFAULT NULL, product_type_id INT DEFAULT NULL, INDEX IDX_DDA8319CBE6903FD (product_category_id), INDEX IDX_DDA8319C14959723 (product_type_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE product_color (id INT AUTO_INCREMENT NOT NULL, color_id INT NOT NULL, product_article_id INT DEFAULT NULL, INDEX IDX_C70A33B57ADA1FB5 (color_id), INDEX IDX_C70A33B5E1F3D9B7 (product_article_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE product_type (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, public TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE product ADD CONSTRAINT FK_D34A04ADBE6903FD FOREIGN KEY (product_category_id) REFERENCES product_category (id)');
$this->addSql('ALTER TABLE product ADD CONSTRAINT FK_D34A04AD14959723 FOREIGN KEY (product_type_id) REFERENCES product_type (id)');
$this->addSql('ALTER TABLE product_article ADD CONSTRAINT FK_D3E315D64584665A FOREIGN KEY (product_id) REFERENCES product (id)');
$this->addSql('ALTER TABLE product_category ADD CONSTRAINT FK_CDFC7356BE6903FD FOREIGN KEY (product_category_id) REFERENCES product_category (id)');
$this->addSql('ALTER TABLE product_category_type ADD CONSTRAINT FK_DDA8319CBE6903FD FOREIGN KEY (product_category_id) REFERENCES product_category (id)');
$this->addSql('ALTER TABLE product_category_type ADD CONSTRAINT FK_DDA8319C14959723 FOREIGN KEY (product_type_id) REFERENCES product_type (id)');
$this->addSql('ALTER TABLE product_color ADD CONSTRAINT FK_C70A33B57ADA1FB5 FOREIGN KEY (color_id) REFERENCES color (id)');
$this->addSql('ALTER TABLE product_color ADD CONSTRAINT FK_C70A33B5E1F3D9B7 FOREIGN KEY (product_article_id) REFERENCES product_article (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE product_color DROP FOREIGN KEY FK_C70A33B57ADA1FB5');
$this->addSql('ALTER TABLE product_article DROP FOREIGN KEY FK_D3E315D64584665A');
$this->addSql('ALTER TABLE product_color DROP FOREIGN KEY FK_C70A33B5E1F3D9B7');
$this->addSql('ALTER TABLE product DROP FOREIGN KEY FK_D34A04ADBE6903FD');
$this->addSql('ALTER TABLE product_category DROP FOREIGN KEY FK_CDFC7356BE6903FD');
$this->addSql('ALTER TABLE product_category_type DROP FOREIGN KEY FK_DDA8319CBE6903FD');
$this->addSql('ALTER TABLE product DROP FOREIGN KEY FK_D34A04AD14959723');
$this->addSql('ALTER TABLE product_category_type DROP FOREIGN KEY FK_DDA8319C14959723');
$this->addSql('DROP TABLE color');
$this->addSql('DROP TABLE emails');
$this->addSql('DROP TABLE feedback');
$this->addSql('DROP TABLE office');
$this->addSql('DROP TABLE product');
$this->addSql('DROP TABLE product_article');
$this->addSql('DROP TABLE product_category');
$this->addSql('DROP TABLE product_category_type');
$this->addSql('DROP TABLE product_color');
$this->addSql('DROP TABLE product_type');
}
}