1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace DoctrineMigrations; |
6
|
|
|
|
7
|
|
|
use Doctrine\DBAL\Schema\Schema; |
8
|
|
|
use Doctrine\Migrations\AbstractMigration; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Auto-generated Migration: Please modify to your needs! |
12
|
|
|
*/ |
13
|
|
|
final class Version20200602193228 extends AbstractMigration |
14
|
|
|
{ |
15
|
|
|
public function getDescription() : string |
16
|
|
|
{ |
17
|
|
|
return ''; |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
public function up(Schema $schema) : void |
21
|
|
|
{ |
22
|
|
|
// this up() migration is auto-generated, please modify it to your needs |
23
|
|
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); |
24
|
|
|
|
25
|
|
|
$this->addSql('CREATE TABLE article (id INT AUTO_INCREMENT NOT NULL, artnum VARCHAR(255) NOT NULL, parentid INT DEFAULT NULL, asy_packaging INT DEFAULT NULL, asy_min_order INT DEFAULT NULL, asy_installation VARCHAR(255) DEFAULT NULL, title VARCHAR(255) DEFAULT NULL, shortdesc VARCHAR(255) DEFAULT NULL, longdesc LONGTEXT DEFAULT NULL, unitname VARCHAR(255) DEFAULT NULL, asy_deltext_standard_1 VARCHAR(255) DEFAULT NULL, asy_deltext_standard_schweiz VARCHAR(255) DEFAULT NULL, asy_deltext_standard_2 VARCHAR(255) DEFAULT NULL, alphabytes_variantenmerkmale VARCHAR(255) DEFAULT NULL, asy_deltext_standard VARCHAR(255) DEFAULT NULL, varname VARCHAR(255) DEFAULT NULL, varselect VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); |
26
|
|
|
$this->addSql('CREATE TABLE attribute (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) DEFAULT NULL, swffexporttoff VARCHAR(255) DEFAULT NULL, swffexporttitle VARCHAR(255) DEFAULT NULL, pos INT DEFAULT NULL, displayinbasket TINYINT(1) DEFAULT NULL, cmiuuid VARCHAR(255) NOT NULL, unit VARCHAR(255) DEFAULT NULL, variant_attribute_sort INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); |
27
|
|
|
$this->addSql('CREATE TABLE category (id INT AUTO_INCREMENT NOT NULL, cmiuuid VARCHAR(255) DEFAULT NULL, parentid VARCHAR(255) DEFAULT NULL, title VARCHAR(255) DEFAULT NULL, sort INT DEFAULT NULL, active TINYINT(1) DEFAULT NULL, hidden TINYINT(1) DEFAULT NULL, template VARCHAR(255) DEFAULT NULL, asy_cattype INT DEFAULT NULL, crosssellingtitle VARCHAR(255) DEFAULT NULL, crosssellingtitle_1 VARCHAR(255) DEFAULT NULL, crosssellingtitle_2 VARCHAR(255) DEFAULT NULL, asy_setcategory TINYINT(1) DEFAULT NULL, cat_desc VARCHAR(255) DEFAULT NULL, shortdesc VARCHAR(255) DEFAULT NULL, longdesc LONGTEXT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); |
28
|
|
|
$this->addSql('CREATE TABLE object2attribute (id INT AUTO_INCREMENT NOT NULL, object_id INT NOT NULL, attr_id INT NOT NULL, alpha_variantmerkmal TINYINT(1) DEFAULT NULL, value VARCHAR(255) DEFAULT NULL, value_2 VARCHAR(255) DEFAULT NULL, INDEX IDX_9DDC5FBC232D562B (object_id), INDEX IDX_9DDC5FBC747AE5C2 (attr_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); |
29
|
|
|
$this->addSql('CREATE TABLE object2category (id INT AUTO_INCREMENT NOT NULL, catnid INT NOT NULL, objectid INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); |
30
|
|
|
$this->addSql('ALTER TABLE object2attribute ADD CONSTRAINT FK_9DDC5FBC232D562B FOREIGN KEY (object_id) REFERENCES article (id)'); |
31
|
|
|
$this->addSql('ALTER TABLE object2attribute ADD CONSTRAINT FK_9DDC5FBC747AE5C2 FOREIGN KEY (attr_id) REFERENCES attribute (id)'); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function down(Schema $schema) : void |
35
|
|
|
{ |
36
|
|
|
// this down() migration is auto-generated, please modify it to your needs |
37
|
|
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); |
38
|
|
|
|
39
|
|
|
$this->addSql('ALTER TABLE object2attribute DROP FOREIGN KEY FK_9DDC5FBC232D562B'); |
40
|
|
|
$this->addSql('ALTER TABLE object2attribute DROP FOREIGN KEY FK_9DDC5FBC747AE5C2'); |
41
|
|
|
$this->addSql('DROP TABLE article'); |
42
|
|
|
$this->addSql('DROP TABLE attribute'); |
43
|
|
|
$this->addSql('DROP TABLE category'); |
44
|
|
|
$this->addSql('DROP TABLE object2attribute'); |
45
|
|
|
$this->addSql('DROP TABLE object2category'); |
46
|
|
|
} |
47
|
|
|
} |
48
|
|
|
|