-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'remotes/dev/1.10' into 1.10
- Loading branch information
Showing
11 changed files
with
137 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/OroCRM/Bundle/MagentoBundle/Migrations/Schema/v1_41_3/UpdateCartIndexes.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace OroCRM\Bundle\MagentoBundle\Migrations\Schema\v1_41_3; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
|
||
use Oro\Bundle\MigrationBundle\Migration\Migration; | ||
use Oro\Bundle\MigrationBundle\Migration\QueryBag; | ||
|
||
class UpdateCartIndexes implements Migration | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function up(Schema $schema, QueryBag $queries) | ||
{ | ||
$table = $schema->getTable('orocrm_magento_cart'); | ||
if (!$table->hasIndex('magecart_payment_details_idx')) { | ||
$table->addIndex(['payment_details'], 'magecart_payment_details_idx', []); | ||
} | ||
if (!$table->hasIndex('status_name_items_qty_idx')) { | ||
$table->addIndex(['status_name', 'items_qty'], 'status_name_items_qty_idx', []); | ||
} | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
src/OroCRM/Bundle/MagentoBundle/Migrations/Schema/v1_41_4/OroCRMMagentoBundle.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
namespace OroCRM\Bundle\MagentoBundle\Migrations\Schema\v1_41_4; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Oro\Bundle\MigrationBundle\Migration\Migration; | ||
use Oro\Bundle\MigrationBundle\Migration\QueryBag; | ||
|
||
class OroCRMMagentoBundle implements Migration | ||
{ | ||
/** | ||
* Changes account_id to onDelete=CASCADE | ||
* | ||
* {@inheritdoc} | ||
*/ | ||
public function up(Schema $schema, QueryBag $queries) | ||
{ | ||
$this->changeOnDeleteToCascade( | ||
$schema, | ||
[ | ||
'orocrm_magento_customer' => ['account_id'], | ||
] | ||
); | ||
} | ||
|
||
/** | ||
* @param Schema $schema | ||
* @param array $data | ||
* [ | ||
* table name => [column name, ...], | ||
* ... | ||
* ] | ||
*/ | ||
protected function changeOnDeleteToCascade(Schema $schema, array $data) | ||
{ | ||
foreach ($data as $tableName => $columns) { | ||
$table = $schema->getTable($tableName); | ||
foreach ($columns as $column) { | ||
$foreignKeys = $table->getForeignKeys(); | ||
foreach ($foreignKeys as $foreignKey) { | ||
$foreignKeyColumns = $foreignKey->getUnquotedLocalColumns(); | ||
if ($foreignKeyColumns === [$column]) { | ||
if ($foreignKey->getOption('onDelete') !== 'CASCADE') { | ||
$table->removeForeignKey($foreignKey->getName()); | ||
$table->addForeignKeyConstraint( | ||
$foreignKey->getUnqualifiedForeignTableName(), | ||
$foreignKeyColumns, | ||
$foreignKey->getUnquotedForeignColumns(), | ||
['onDelete' => 'CASCADE', 'onUpdate' => $foreignKey->getOption('onUpdate')] | ||
); | ||
} | ||
|
||
break; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters