From 1763e4e2b6fce6970edea92976d340656fd76e7e Mon Sep 17 00:00:00 2001 From: Dominik Pfaffenbauer Date: Thu, 2 May 2019 17:20:24 +0200 Subject: [PATCH] [Migration] only add indices to store_price table if table actually exists. In some rare cases, the table might not exist anymore --- .../CoreBundle/Migrations/Version20190430134834.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/CoreShop/Bundle/CoreBundle/Migrations/Version20190430134834.php b/src/CoreShop/Bundle/CoreBundle/Migrations/Version20190430134834.php index b51cfad560..58d9ba8353 100644 --- a/src/CoreShop/Bundle/CoreBundle/Migrations/Version20190430134834.php +++ b/src/CoreShop/Bundle/CoreBundle/Migrations/Version20190430134834.php @@ -15,9 +15,11 @@ class Version20190430134834 extends AbstractPimcoreMigration */ public function up(Schema $schema) { - $this->addSql('ALTER TABLE coreshop_product_store_price CHANGE property property VARCHAR(190) NOT NULL;'); - $this->addSql('CREATE INDEX IDX_514E3EBF367996058BF21CDE ON coreshop_product_store_price (productId, property);'); - $this->addSql('CREATE INDEX IDX_514E3EBF367996052F738A528BF21CDE ON coreshop_product_store_price (productId, storeId, property);'); + if ($schema->hasTable('coreshop_product_store_price')) { + $this->addSql('ALTER TABLE coreshop_product_store_price CHANGE property property VARCHAR(190) NOT NULL;'); + $this->addSql('CREATE INDEX IDX_514E3EBF367996058BF21CDE ON coreshop_product_store_price (productId, property);'); + $this->addSql('CREATE INDEX IDX_514E3EBF367996052F738A528BF21CDE ON coreshop_product_store_price (productId, storeId, property);'); + } } /**