Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add onDelete cascade on foreign key constraint between MenuUpdate and Scope #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class OroCommerceMenuBundleInstaller implements
*/
public function getMigrationVersion()
{
return 'v1_7';
return 'v1_8';
}

/**
Expand Down Expand Up @@ -188,7 +188,8 @@ protected function addOroCommerceMenuUpdateForeignKeys(Schema $schema)
$table->addForeignKeyConstraint(
$schema->getTable('oro_scope'),
['scope_id'],
['id']
['id'],
['onUpdate' => null, 'onDelete' => 'CASCADE']
);
$table->addForeignKeyConstraint(
$schema->getTable('oro_web_catalog_content_node'),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace Oro\Bundle\CommerceMenuBundle\Migrations\Schema\v1_8;

use Doctrine\DBAL\Schema\Schema;
use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;

class AddScopeToMenuUpdateTable implements Migration
{

/**
* {@inheritdoc}
*/
public function up(Schema $schema, QueryBag $queries)
{
/** Table updates **/
$this->addOroCommerceMenuUpdateForeignKeys($schema);
}

/**
* Add oro_commerce_menu_upd foreign keys.
*
* @param Schema $schema
*/
protected function addOroCommerceMenuUpdateForeignKeys(Schema $schema)
{
$table = $schema->getTable('oro_commerce_menu_upd');
$table->addForeignKeyConstraint(
$schema->getTable('oro_scope'),
['scope_id'],
['id'],
['onUpdate' => null, 'onDelete' => 'CASCADE']
);
}
}