From 0603090c4a8687cded4e036c89ea424abcd5599f Mon Sep 17 00:00:00 2001 From: Mateusz Zalewski Date: Tue, 22 Jan 2019 10:14:33 +0100 Subject: [PATCH] Add missing migration and remove unused use statements --- src/Migrations/Version20170912085504.php | 6 ++--- src/Migrations/Version20170913125128.php | 6 ++--- src/Migrations/Version20171003103916.php | 6 ++--- src/Migrations/Version20180102140039.php | 6 ++--- src/Migrations/Version20190109095211.php | 34 ++++++++++++++++++++++++ src/Migrations/Version20190109160409.php | 30 +++++++++++++++++++++ 6 files changed, 76 insertions(+), 12 deletions(-) create mode 100644 src/Migrations/Version20190109095211.php create mode 100644 src/Migrations/Version20190109160409.php diff --git a/src/Migrations/Version20170912085504.php b/src/Migrations/Version20170912085504.php index 883ee10256..2f9bf97fd1 100644 --- a/src/Migrations/Version20170912085504.php +++ b/src/Migrations/Version20170912085504.php @@ -4,8 +4,8 @@ namespace DoctrineMigrations; -use Doctrine\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; +use Doctrine\Migrations\AbstractMigration; /** * Auto-generated Migration: Please modify to your needs! @@ -15,7 +15,7 @@ class Version20170912085504 extends AbstractMigration /** * @param Schema $schema */ - public function up(Schema $schema) : void + public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); @@ -188,7 +188,7 @@ public function up(Schema $schema) : void /** * @param Schema $schema */ - public function down(Schema $schema) : void + public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); diff --git a/src/Migrations/Version20170913125128.php b/src/Migrations/Version20170913125128.php index 8b4db99976..12a6b3446e 100644 --- a/src/Migrations/Version20170913125128.php +++ b/src/Migrations/Version20170913125128.php @@ -4,8 +4,8 @@ namespace DoctrineMigrations; -use Doctrine\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; +use Doctrine\Migrations\AbstractMigration; /** * Auto-generated Migration: Please modify to your needs! @@ -15,7 +15,7 @@ class Version20170913125128 extends AbstractMigration /** * @param Schema $schema */ - public function up(Schema $schema) : void + public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); @@ -47,7 +47,7 @@ public function up(Schema $schema) : void /** * @param Schema $schema */ - public function down(Schema $schema) : void + public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); diff --git a/src/Migrations/Version20171003103916.php b/src/Migrations/Version20171003103916.php index 5442bbe1a5..4851bc5d63 100644 --- a/src/Migrations/Version20171003103916.php +++ b/src/Migrations/Version20171003103916.php @@ -4,8 +4,8 @@ namespace DoctrineMigrations; -use Doctrine\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; +use Doctrine\Migrations\AbstractMigration; use Sylius\Component\Attribute\AttributeType\SelectAttributeType; use Sylius\Component\Product\Model\ProductAttributeInterface; use Symfony\Component\DependencyInjection\ContainerAwareInterface; @@ -32,7 +32,7 @@ public function setContainer(?ContainerInterface $container = null): void /** * @param Schema $schema */ - public function up(Schema $schema) : void + public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.'); @@ -68,7 +68,7 @@ public function up(Schema $schema) : void /** * @param Schema $schema */ - public function down(Schema $schema) : void + public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.'); diff --git a/src/Migrations/Version20180102140039.php b/src/Migrations/Version20180102140039.php index b2f89d8d29..67e345b21a 100644 --- a/src/Migrations/Version20180102140039.php +++ b/src/Migrations/Version20180102140039.php @@ -4,15 +4,15 @@ namespace DoctrineMigrations; -use Doctrine\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; +use Doctrine\Migrations\AbstractMigration; /** * Auto-generated Migration: Please modify to your needs! */ class Version20180102140039 extends AbstractMigration { - public function up(Schema $schema) : void + public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); @@ -20,7 +20,7 @@ public function up(Schema $schema) : void $this->addSql('CREATE INDEX IDX_16C8119EE551C011 ON sylius_channel (hostname)'); } - public function down(Schema $schema) : void + public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); diff --git a/src/Migrations/Version20190109095211.php b/src/Migrations/Version20190109095211.php new file mode 100644 index 0000000000..cfe7c748c3 --- /dev/null +++ b/src/Migrations/Version20190109095211.php @@ -0,0 +1,34 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('CREATE TABLE sylius_shop_billing_data (id INT AUTO_INCREMENT NOT NULL, company VARCHAR(255) DEFAULT NULL, tax_id VARCHAR(255) DEFAULT NULL, country_code VARCHAR(255) DEFAULT NULL, street VARCHAR(255) DEFAULT NULL, city VARCHAR(255) DEFAULT NULL, postcode VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE UTF8_unicode_ci ENGINE = InnoDB'); + $this->addSql('ALTER TABLE sylius_channel ADD shop_billing_data_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE sylius_channel ADD CONSTRAINT FK_16C8119EB5282EDF FOREIGN KEY (shop_billing_data_id) REFERENCES sylius_shop_billing_data (id) ON DELETE CASCADE'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_16C8119EB5282EDF ON sylius_channel (shop_billing_data_id)'); + } + + public function down(Schema $schema): void + { + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE sylius_channel DROP FOREIGN KEY FK_16C8119EB5282EDF'); + $this->addSql('DROP TABLE sylius_shop_billing_data'); + $this->addSql('DROP INDEX UNIQ_16C8119EB5282EDF ON sylius_channel'); + $this->addSql('ALTER TABLE sylius_channel DROP shop_billing_data_id'); + } +} diff --git a/src/Migrations/Version20190109160409.php b/src/Migrations/Version20190109160409.php new file mode 100644 index 0000000000..eb49cbb83f --- /dev/null +++ b/src/Migrations/Version20190109160409.php @@ -0,0 +1,30 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE sylius_shop_user ADD encoder_name VARCHAR(255) DEFAULT NULL'); + $this->addSql('ALTER TABLE sylius_admin_user ADD encoder_name VARCHAR(255) DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE sylius_admin_user DROP encoder_name'); + $this->addSql('ALTER TABLE sylius_shop_user DROP encoder_name'); + } +}