-
Notifications
You must be signed in to change notification settings - Fork 254
Description
Currently, we have a Foreign Key constraint for the SourceItem table definition referring to catalog_product_entity by SKU
namespace Magento\Inventory\Setup\Operation;
class CreateSourceItemTable
{
//...
)->addForeignKey(
$setup->getFkName(
$sourceItemTable,
SourceItemInterface::SKU,
'catalog_product_entity',
'sku'
),
SourceItemInterface::SKU,
'catalog_product_entity',
'sku',
AdapterInterface::FK_ACTION_CASCADE
)
//..
This breaks modularity, because Inventory module relies on private implementation (data storage) of Catalog. But Data Storage as well as Data Access Layer supposed to be a private detail not eligible to be refered from outside of Bounded Context (read from other modules).
That's why Data Integrity should be supported on the level of Application, but not data storage (Database).
Because in current implementation we could not build independent customizable Inventory micro service, with own data storage being hosted on a dedicated server.
Based on the above - we need to drop DB FK constraint on Catalog table, and in future prevent such dependencies to appear.