Drupal currently does not make any use of foreign keys in the database (see 🐛 Document that foreign keys may not be used by all drivers Fixed ). DBTNG should provide methods for developers to create foreign keys if they want to use them.
<!--break-->Currently, foreign keys are defined in hook_schema() implementations like this:
'foreign keys' => [
'node_revision' => [
'table' => 'node_revision',
'columns' => [
'vid' => 'vid',
],
],
],
I suggest that a developer who wants the foreign key to be created would do it like this:
'foreign keys' => [
'node_revision' => [
'table' => 'node_revision',
'columns' => [
'vid' => 'vid',
],
'on update' => 'cascade',
'on delete' => 'set null',
],
],
If both 'on update' and 'on delete' are set to valid values, FKs would be created in the database, otherwise, they would not be. Valid values are: "restrict", "cascade", "set null", and "set default" ("no action" is valid in SQL but will not be supported for the reason given in #137).
Changes required for each database driver:
Needs work
11.0 🔥
database system
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.