foreign key in magento 2 code example
Example: magento 1 setup add foreign key
->addForeignKey(
$installer->getFkName('namespace_module/shop', 'area_id', 'namespace_module/area','area_id'),
'area_id',
$installer->getTable('namespace_module/area'),
'area_id',
Varien_Db_Ddl_Table::ACTION_CASCADE,
Varien_Db_Ddl_Table::ACTION_CASCADE
)