Skip to content

Instantly share code, notes, and snippets.

@apedicdev
Last active July 26, 2017 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apedicdev/0522d4a3dd8212c9b813ab4a24407b55 to your computer and use it in GitHub Desktop.
Save apedicdev/0522d4a3dd8212c9b813ab4a24407b55 to your computer and use it in GitHub Desktop.
magento 2 add foreign key
->addForeignKey(
$installer->getFkName($tableName, COLUMN_NAME, $tableNameFkName, COLUMNFK_NAME),
COLUMN_NAME, //column has to be UNSIGNED if the foreign column is
$installer->getTable($tableNameFkName),
COLUMNFK_NAME,
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
)
;
@apedicdev
Copy link
Author

column has to be UNSIGNED if the foreign column is

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment