From db5368027e7b38a274e17bf002f543a0ffbbd7ae Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 22 Aug 2010 13:55:53 +0000 Subject: - Patch #880132 by bojanz: hook_schema() doesn't support compound foreign keys; inconsistent implementations in core. --- includes/database/schema.inc | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'includes') diff --git a/includes/database/schema.inc b/includes/database/schema.inc index 2c3309562..187f9e6b8 100644 --- a/includes/database/schema.inc +++ b/includes/database/schema.inc @@ -75,10 +75,11 @@ * - 'unique keys': An associative array of unique keys ('keyname' => * specification). Each specification is an array of one or more * key column specifiers (see below) that form a unique key on the table. - * - 'foreign keys': An associative array, each key references a column - * of the local table, each value is an array with a single key pair as - * 'tablename' => 'column' where 'column' is the foreign column to - * reference. + * - 'foreign keys': An associative array of relations ('my_relation' => + * specification). Each specification is an array containing the name of + * the referenced table ('table'), and an array of column mappings + * ('columns'). Column mappings are defined by key pairs ('source_column' => + * 'referenced_column'). * - 'indexes': An associative array of indexes ('indexname' => * specification). Each specification is an array of one or more * key column specifiers (see below) that form an index on the @@ -131,8 +132,14 @@ * 'vid' => array('vid'), * ), * 'foreign keys' => array( - * 'vid' => array('node_revision' => 'vid'), - * 'uid' => array('users' => 'uid'), + * 'node_revision' => array( + * 'table' => 'node_revision', + * 'columns' => array('vid' => 'vid'), + * ), + * 'node_author' => array( + * 'table' => 'users', + * 'columns' => array('uid' => 'uid'), + * ), * ), * 'primary key' => array('nid'), * ); -- cgit v1.2.3