Skip to content

Commit

Permalink
Merge pull request #1032 from solverat/bigint_fix
Browse files Browse the repository at this point in the history
change db type for pricing fields to BIGINT
  • Loading branch information
dpfaffenbauer authored Jun 18, 2019
2 parents 83bae71 + 1136526 commit f002b2f
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace CoreShop\Bundle\CoreBundle\Migrations;

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

/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20190617082805 extends AbstractPimcoreMigration
{
public function up(Schema $schema)
{
if ($schema->hasTable('coreshop_product_store_values')) {
$table = $schema->getTable('coreshop_product_store_values');
if ($table->hasColumn('price')) {
if (!$table->getColumn('price')->getType() instanceof BigIntType) {
$this->addSql('ALTER TABLE coreshop_product_store_values CHANGE price price BIGINT NOT NULL;');
}
}
}

if ($schema->hasTable('coreshop_product_unit_definition_price')) {
$table = $schema->getTable('coreshop_product_unit_definition_price');
if ($table->hasColumn('price')) {
if (!$table->getColumn('price')->getType() instanceof BigIntType) {
$this->addSql('ALTER TABLE coreshop_product_unit_definition_price CHANGE price price BIGINT NOT NULL;');
}
}
}

if ($schema->hasTable('coreshop_product_quantity_price_rule_range')) {
$table = $schema->getTable('coreshop_product_quantity_price_rule_range');
if ($table->hasColumn('amount')) {
if (!$table->getColumn('amount')->getType() instanceof BigIntType) {
$this->addSql('ALTER TABLE coreshop_product_quantity_price_rule_range CHANGE amount amount BIGINT NOT NULL;');
}
}

if ($table->hasColumn('pseudo_price')) {
if (!$table->getColumn('pseudo_price')->getType() instanceof BigIntType) {
$this->addSql('ALTER TABLE coreshop_product_quantity_price_rule_range CHANGE pseudo_price pseudo_price BIGINT NOT NULL;');
}
}
}
}

/**
* @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 @@ -13,7 +13,7 @@ CoreShop\Component\Core\Model\ProductStoreValues:
type: pimcoreObject
price:
column: price
type: integer
type: bigint
manyToOne:
store:
targetEntity: CoreShop\Component\Store\Model\StoreInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ CoreShop\Component\Core\Model\QuantityRange:
fields:
amount:
column: amount
type: integer
type: bigint
pseudoPrice:
column: pseudo_price
type: integer
type: bigint
manyToOne:
currency:
targetEntity: CoreShop\Component\Currency\Model\CurrencyInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CoreShop\Component\Product\Model\ProductUnitDefinitionPrice:
strategy: AUTO
price:
column: price
type: integer
type: bigint
manyToOne:
unitDefinition:
targetEntity: CoreShop\Component\Product\Model\ProductUnitDefinitionInterface
Expand Down

0 comments on commit f002b2f

Please sign in to comment.