From a20b48b48e65b52d5aef97f1dd202e3959e59410 Mon Sep 17 00:00:00 2001 From: Dominik Pfaffenbauer Date: Tue, 30 Apr 2019 15:52:00 +0200 Subject: [PATCH] [CoreBundle] add index to StorePrice Entity --- .../Migrations/Version20190430134834.php | 31 +++++++++++++++++++ .../doctrine/model/ProductStorePrice.orm.yml | 6 +++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/CoreShop/Bundle/CoreBundle/Migrations/Version20190430134834.php diff --git a/src/CoreShop/Bundle/CoreBundle/Migrations/Version20190430134834.php b/src/CoreShop/Bundle/CoreBundle/Migrations/Version20190430134834.php new file mode 100644 index 0000000000..b51cfad560 --- /dev/null +++ b/src/CoreShop/Bundle/CoreBundle/Migrations/Version20190430134834.php @@ -0,0 +1,31 @@ +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);'); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + // this down() migration is auto-generated, please modify it to your needs + + } +} diff --git a/src/CoreShop/Bundle/CoreBundle/Resources/config/doctrine/model/ProductStorePrice.orm.yml b/src/CoreShop/Bundle/CoreBundle/Resources/config/doctrine/model/ProductStorePrice.orm.yml index 7a8eea2127..bba481d33c 100644 --- a/src/CoreShop/Bundle/CoreBundle/Resources/config/doctrine/model/ProductStorePrice.orm.yml +++ b/src/CoreShop/Bundle/CoreBundle/Resources/config/doctrine/model/ProductStorePrice.orm.yml @@ -14,6 +14,7 @@ CoreShop\Component\Core\Model\ProductStorePrice: property: column: property type: string + length: 190 price: column: price type: integer @@ -23,4 +24,7 @@ CoreShop\Component\Core\Model\ProductStorePrice: joinColumn: name: storeId referencedColumnName: id - onDelete: 'SET NULL' \ No newline at end of file + onDelete: 'SET NULL' + indexes: + - columns: productId, property + - columns: productId, storeId, property