Skip to content

Commit

Permalink
Merge pull request #962 from dpfaffenbauer/store-price-performance
Browse files Browse the repository at this point in the history
[CoreBundle] add index to StorePrice Entity for better performance
  • Loading branch information
dpfaffenbauer authored May 1, 2019
2 parents 976f248 + a20b48b commit e3b2a58
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace CoreShop\Bundle\CoreBundle\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Pimcore\Migrations\Migration\AbstractPimcoreMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20190430134834 extends AbstractPimcoreMigration
{
/**
* @param Schema $schema
*/
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);');
}

/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
// this down() migration is auto-generated, please modify it to your needs

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ CoreShop\Component\Core\Model\ProductStorePrice:
property:
column: property
type: string
length: 190
price:
column: price
type: integer
Expand All @@ -23,4 +24,7 @@ CoreShop\Component\Core\Model\ProductStorePrice:
joinColumn:
name: storeId
referencedColumnName: id
onDelete: 'SET NULL'
onDelete: 'SET NULL'
indexes:
- columns: productId, property
- columns: productId, storeId, property

0 comments on commit e3b2a58

Please sign in to comment.