summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/database/schema.inc19
-rw-r--r--modules/aggregator/aggregator.install15
-rw-r--r--modules/comment/comment.install22
-rw-r--r--modules/forum/forum.install33
-rw-r--r--modules/image/image.install10
-rw-r--r--modules/locale/locale.install5
-rw-r--r--modules/node/node.install27
-rw-r--r--modules/poll/poll.install20
-rw-r--r--modules/profile/profile.install10
-rw-r--r--modules/search/search.install9
-rw-r--r--modules/shortcut/shortcut.install15
-rw-r--r--modules/statistics/statistics.install5
-rw-r--r--modules/system/system.api.php10
-rw-r--r--modules/system/system.install10
-rw-r--r--modules/taxonomy/taxonomy.install30
-rw-r--r--modules/tracker/tracker.install30
-rw-r--r--modules/trigger/trigger.install5
-rw-r--r--modules/user/user.install25
18 files changed, 241 insertions, 59 deletions
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'),
* );
diff --git a/modules/aggregator/aggregator.install b/modules/aggregator/aggregator.install
index 43fcf8119..6f5230db7 100644
--- a/modules/aggregator/aggregator.install
+++ b/modules/aggregator/aggregator.install
@@ -80,7 +80,10 @@ function aggregator_schema() {
'fid' => array('fid'),
),
'foreign keys' => array(
- 'cid' => array('aggregator_category' => 'cid'),
+ 'aggregator_category' => array(
+ 'table' => 'aggregator_category',
+ 'columns' => array('cid' => 'cid'),
+ ),
),
);
@@ -105,7 +108,10 @@ function aggregator_schema() {
'iid' => array('iid'),
),
'foreign keys' => array(
- 'cid' => array('aggregator_category' => 'cid'),
+ 'aggregator_category' => array(
+ 'table' => 'aggregator_category',
+ 'columns' => array('cid' => 'cid'),
+ ),
),
);
@@ -264,7 +270,10 @@ function aggregator_schema() {
'fid' => array('fid'),
),
'foreign keys' => array(
- 'fid' => array('aggregator_feed' => 'fid'),
+ 'aggregator_feed' => array(
+ 'table' => 'aggregator_feed',
+ 'columns' => array('fid' => 'fid'),
+ ),
),
);
diff --git a/modules/comment/comment.install b/modules/comment/comment.install
index b7a249044..964927ad5 100644
--- a/modules/comment/comment.install
+++ b/modules/comment/comment.install
@@ -456,8 +456,14 @@ function comment_schema() {
),
'primary key' => array('cid'),
'foreign keys' => array(
- 'nid' => array('node' => 'nid'),
- 'uid' => array('users' => 'uid'),
+ 'comment_node' => array(
+ 'table' => 'node',
+ 'columns' => array('nid' => 'nid'),
+ ),
+ 'comment_author' => array(
+ 'table' => 'users',
+ 'columns' => array('uid' => 'uid'),
+ ),
),
);
@@ -510,8 +516,16 @@ function comment_schema() {
'last_comment_uid' => array('last_comment_uid'),
),
'foreign keys' => array(
- 'nid' => array('node' => 'nid'),
- 'last_comment_uid' => array('users' => 'uid'),
+ 'statistics_node' => array(
+ 'table' => 'node',
+ 'columns' => array('nid' => 'nid'),
+ ),
+ 'last_comment_author' => array(
+ 'table' => 'users',
+ 'columns' => array(
+ 'last_comment_uid' => 'uid',
+ ),
+ ),
),
);
diff --git a/modules/forum/forum.install b/modules/forum/forum.install
index 205430dd1..9a1ae18f6 100644
--- a/modules/forum/forum.install
+++ b/modules/forum/forum.install
@@ -153,8 +153,13 @@ function forum_schema() {
),
'primary key' => array('vid'),
'foreign keys' => array(
- 'nid' => array('node' => 'nid'),
- 'vid' => array('node' => 'vid'),
+ 'forum_node' => array(
+ 'table' => 'node',
+ 'columns' => array(
+ 'nid' => 'nid',
+ 'vid' => 'vid',
+ ),
+ ),
),
);
@@ -214,8 +219,16 @@ function forum_schema() {
'forum_topics' => array('tid', 'sticky', 'last_comment_timestamp'),
),
'foreign keys' => array(
- 'node' => 'nid',
- 'taxonomy_term_data' => 'tid',
+ 'tracked_node' => array(
+ 'table' => 'node',
+ 'columns' => array('nid' => 'nid'),
+ ),
+ 'term' => array(
+ 'table' => 'taxonomy_term_data',
+ 'columns' => array(
+ 'tid' => 'tid',
+ ),
+ ),
),
);
@@ -291,8 +304,16 @@ function forum_update_7001() {
'forum_topics' => array('tid', 'sticky', 'last_comment_timestamp'),
),
'foreign keys' => array(
- 'node' => 'nid',
- 'taxonomy_term_data' => 'tid',
+ 'tracked_node' => array(
+ 'table' => 'node',
+ 'columns' => array('nid' => 'nid'),
+ ),
+ 'term' => array(
+ 'table' => 'taxonomy_term_data',
+ 'columns' => array(
+ 'tid' => 'tid',
+ ),
+ ),
),
);
db_create_table('forum_index', $forum_index);
diff --git a/modules/image/image.install b/modules/image/image.install
index 0fb19c6e3..c7ae8c57a 100644
--- a/modules/image/image.install
+++ b/modules/image/image.install
@@ -98,7 +98,10 @@ function image_schema() {
'weight' => array('weight'),
),
'foreign keys' => array(
- 'isid' => array('image_styles' => 'isid'),
+ 'image_style' => array(
+ 'table' => 'image_styles',
+ 'columns' => array('isid' => 'isid'),
+ ),
),
);
@@ -180,7 +183,10 @@ function image_update_7000() {
'weight' => array('weight'),
),
'foreign keys' => array(
- 'isid' => array('image_styles' => 'isid'),
+ 'image_style' => array(
+ 'table' => 'image_styles',
+ 'columns' => array('isid' => 'isid'),
+ ),
),
);
diff --git a/modules/locale/locale.install b/modules/locale/locale.install
index 221241605..3bbb3bbae 100644
--- a/modules/locale/locale.install
+++ b/modules/locale/locale.install
@@ -335,7 +335,10 @@ function locale_schema() {
),
'primary key' => array('language', 'lid', 'plural'),
'foreign keys' => array(
- 'lid' => array('locales_source' => 'lid'),
+ 'locales_source' => array(
+ 'table' => 'locales_source',
+ 'columns' => array('lid' => 'lid'),
+ ),
),
'indexes' => array(
'lid' => array('lid'),
diff --git a/modules/node/node.install b/modules/node/node.install
index cc3d8ee97..81ad93b3e 100644
--- a/modules/node/node.install
+++ b/modules/node/node.install
@@ -118,8 +118,14 @@ function node_schema() {
'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'),
);
@@ -174,7 +180,12 @@ function node_schema() {
),
),
'primary key' => array('nid', 'gid', 'realm'),
- 'foreign keys' => array('node' => 'nid'),
+ 'foreign keys' => array(
+ 'affected_node' => array(
+ 'table' => 'node',
+ 'columns' => array('nid' => 'nid'),
+ ),
+ ),
);
$schema['node_revision'] = array(
@@ -249,8 +260,14 @@ function node_schema() {
),
'primary key' => array('vid'),
'foreign keys' => array(
- 'node' => 'nid',
- 'users' => 'uid'
+ 'versioned_node' => array(
+ 'table' => 'node',
+ 'columns' => array('nid' => 'nid'),
+ ),
+ 'version_author' => array(
+ 'table' => 'users',
+ 'columns' => array('uid' => 'uid'),
+ ),
),
);
diff --git a/modules/poll/poll.install b/modules/poll/poll.install
index 8fe8ef1b7..931fcfb61 100644
--- a/modules/poll/poll.install
+++ b/modules/poll/poll.install
@@ -36,7 +36,10 @@ function poll_schema() {
),
'primary key' => array('nid'),
'foreign keys' => array(
- 'nid' => array('node' => 'nid'),
+ 'poll_node' => array(
+ 'table' => 'node',
+ 'columns' => array('nid' => 'nid'),
+ ),
),
);
@@ -82,7 +85,10 @@ function poll_schema() {
),
'primary key' => array('chid'),
'foreign keys' => array(
- 'nid' => array('node' => 'nid'),
+ 'choice_node' => array(
+ 'table' => 'node',
+ 'columns' => array('nid' => 'nid'),
+ ),
),
);
@@ -124,8 +130,14 @@ function poll_schema() {
),
'primary key' => array('nid', 'uid', 'hostname'),
'foreign keys' => array(
- 'nid' => array('node' => 'nid'),
- 'uid' => array('users' => 'uid'),
+ 'poll_node' => array(
+ 'table' => 'node',
+ 'columns' => array('nid' => 'nid'),
+ ),
+ 'voter' => array(
+ 'table' => 'users',
+ 'columns' => array('uid' => 'uid'),
+ ),
),
'indexes' => array(
'chid' => array('chid'),
diff --git a/modules/profile/profile.install b/modules/profile/profile.install
index d10dc3a06..31ac41e19 100644
--- a/modules/profile/profile.install
+++ b/modules/profile/profile.install
@@ -138,8 +138,14 @@ function profile_schema() {
'fid' => array('fid'),
),
'foreign keys' => array(
- 'fid' => array('profile_field' => 'fid'),
- 'uid' => array('users' => 'uid'),
+ 'profile_field' => array(
+ 'table' => 'profile_field',
+ 'columns' => array('fid' => 'fid'),
+ ),
+ 'profile_user' => array(
+ 'table' => 'users',
+ 'columns' => array('uid' => 'uid'),
+ ),
),
);
diff --git a/modules/search/search.install b/modules/search/search.install
index a73afc751..de870085d 100644
--- a/modules/search/search.install
+++ b/modules/search/search.install
@@ -85,8 +85,13 @@ function search_schema() {
'sid_type' => array('sid', 'type'),
),
'foreign keys' => array(
- 'sid' => array('search_dataset' => 'sid'),
- 'type' => array('search_dataset' => 'type'),
+ 'search_dataset' => array(
+ 'table' => 'search_dataset',
+ 'columns' => array(
+ 'sid' => 'sid',
+ 'type' => 'type',
+ ),
+ ),
),
'primary key' => array('word', 'sid', 'type'),
);
diff --git a/modules/shortcut/shortcut.install b/modules/shortcut/shortcut.install
index 39032bbc6..ae23d504b 100644
--- a/modules/shortcut/shortcut.install
+++ b/modules/shortcut/shortcut.install
@@ -63,7 +63,10 @@ function shortcut_schema() {
),
'primary key' => array('set_name'),
'foreign keys' => array(
- 'set_name' => array('menu_links' => 'menu_name'),
+ 'menu_name' => array(
+ 'table' => 'menu_links',
+ 'columns' => array('set_name' => 'menu_name'),
+ ),
),
);
@@ -90,8 +93,14 @@ function shortcut_schema() {
'set_name' => array('set_name'),
),
'foreign keys' => array(
- 'uid' => array('users' => 'uid'),
- 'set_name' => array('shortcut_set' => 'set_name'),
+ 'set_user' => array(
+ 'table' => 'users',
+ 'columns' => array('uid' => 'uid'),
+ ),
+ 'set_name' => array(
+ 'table' => 'shortcut_set',
+ 'columns' => array('set_name' => 'set_name'),
+ ),
),
);
diff --git a/modules/statistics/statistics.install b/modules/statistics/statistics.install
index a54a7ffda..553b3033a 100644
--- a/modules/statistics/statistics.install
+++ b/modules/statistics/statistics.install
@@ -90,7 +90,10 @@ function statistics_schema() {
),
'primary key' => array('aid'),
'foreign keys' => array(
- 'uid' => array('users' => 'uid'),
+ 'visitor' => array(
+ 'table' => 'users',
+ 'columns' => array('uid' => 'uid'),
+ ),
),
);
diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index 158345faf..eb5fa4158 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -2566,6 +2566,16 @@ function hook_schema() {
'nid_vid' => array('nid', 'vid'),
'vid' => array('vid')
),
+ 'foreign keys' => array(
+ 'node_revision' => array(
+ 'table' => 'node_revision',
+ 'columns' => array('vid' => 'vid'),
+ ),
+ 'node_author' => array(
+ 'table' => 'users',
+ 'columns' => array('uid' => 'uid')
+ ),
+ ),
'primary key' => array('nid'),
);
return $schema;
diff --git a/modules/system/system.install b/modules/system/system.install
index 174416c05..8774a7d74 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -831,7 +831,10 @@ function system_schema() {
),
'primary key' => array('fid'),
'foreign keys' => array(
- 'uid' => array('users' => 'uid'),
+ 'file_owner' => array(
+ 'table' => 'users',
+ 'columns' => array('uid' => 'uid'),
+ ),
),
);
@@ -1508,7 +1511,10 @@ function system_schema() {
'ssid' => array('ssid'),
),
'foreign keys' => array(
- 'uid' => array('users' => 'uid'),
+ 'session_user' => array(
+ 'table' => 'users',
+ 'columns' => array('uid' => 'uid'),
+ ),
),
);
diff --git a/modules/taxonomy/taxonomy.install b/modules/taxonomy/taxonomy.install
index 35fbca2c9..cc2512206 100644
--- a/modules/taxonomy/taxonomy.install
+++ b/modules/taxonomy/taxonomy.install
@@ -66,7 +66,10 @@ function taxonomy_schema() {
),
'primary key' => array('tid'),
'foreign keys' => array(
- 'vid' => array('taxonomy_vocabulary' => 'vid'),
+ 'vocabulary' => array(
+ 'table' => 'taxonomy_vocabulary',
+ 'columns' => array('vid' => 'vid'),
+ ),
),
'indexes' => array(
'taxonomy_tree' => array('vid', 'weight', 'name'),
@@ -97,7 +100,10 @@ function taxonomy_schema() {
'parent' => array('parent'),
),
'foreign keys' => array(
- 'tid' => array('taxonomy_term_data' => 'tid'),
+ 'taxonomy_term_data' => array(
+ 'table' => 'taxonomy_term_data',
+ 'columns' => array('tid' => 'tid'),
+ ),
),
'primary key' => array('tid', 'parent'),
);
@@ -201,8 +207,14 @@ function taxonomy_schema() {
'nid' => array('nid'),
),
'foreign keys' => array(
- 'node' => 'nid',
- 'taxonomy_term_data' => 'tid',
+ 'tracked_node' => array(
+ 'table' => 'node',
+ 'columns' => array('nid' => 'nid'),
+ ),
+ 'term' => array(
+ 'table' => 'taxonomy_term_data',
+ 'columns' => array('tid' => 'tid'),
+ ),
),
);
@@ -328,8 +340,14 @@ function taxonomy_update_7004() {
'nid' => array('nid'),
),
'foreign keys' => array(
- 'node' => 'nid',
- 'taxonomy_term_data' => 'tid',
+ 'tracked_node' => array(
+ 'table' => 'node',
+ 'columns' => array('nid' => 'nid'),
+ ),
+ 'term' => array(
+ 'table' => 'taxonomy_term_data',
+ 'columns' => array('tid' => 'tid'),
+ ),
),
);
db_create_table('taxonomy_index', $taxonomy_index);
diff --git a/modules/tracker/tracker.install b/modules/tracker/tracker.install
index f377ff007..407109885 100644
--- a/modules/tracker/tracker.install
+++ b/modules/tracker/tracker.install
@@ -56,7 +56,10 @@ function tracker_schema() {
),
'primary key' => array('nid'),
'foreign keys' => array(
- 'node' => 'nid',
+ 'tracked_node' => array(
+ 'table' => 'node',
+ 'columns' => array('nid' => 'nid'),
+ ),
),
);
@@ -96,8 +99,14 @@ function tracker_schema() {
),
'primary key' => array('nid', 'uid'),
'foreign keys' => array(
- 'node' => 'nid',
- 'users' => 'uid',
+ 'tracked_node' => array(
+ 'table' => 'node',
+ 'columns' => array('nid' => 'nid'),
+ ),
+ 'tracked_user' => array(
+ 'table' => 'users',
+ 'columns' => array('uid' => 'uid'),
+ ),
),
);
@@ -143,7 +152,10 @@ function tracker_update_7000() {
),
'primary key' => array('nid'),
'foreign keys' => array(
- 'node' => 'nid',
+ 'tracked_node' => array(
+ 'table' => 'node',
+ 'columns' => array('nid' => 'nid'),
+ ),
),
);
@@ -183,8 +195,14 @@ function tracker_update_7000() {
),
'primary key' => array('nid', 'uid'),
'foreign keys' => array(
- 'node' => 'nid',
- 'users' => 'uid',
+ 'tracked_node' => array(
+ 'table' => 'node',
+ 'columns' => array('nid' => 'nid'),
+ ),
+ 'tracked_user' => array(
+ 'table' => 'users',
+ 'columns' => array('uid' => 'uid'),
+ ),
),
);
diff --git a/modules/trigger/trigger.install b/modules/trigger/trigger.install
index e34c66c27..309ad5747 100644
--- a/modules/trigger/trigger.install
+++ b/modules/trigger/trigger.install
@@ -36,7 +36,10 @@ function trigger_schema() {
),
'primary key' => array('hook', 'aid'),
'foreign keys' => array(
- 'aid' => array('actions' => 'aid'),
+ 'action' => array(
+ 'table' => 'actions',
+ 'columns' => array('aid' => 'aid'),
+ ),
),
);
return $schema;
diff --git a/modules/user/user.install b/modules/user/user.install
index 4eda48c06..a2369684e 100644
--- a/modules/user/user.install
+++ b/modules/user/user.install
@@ -45,7 +45,10 @@ function user_schema() {
),
'primary key' => array('aid'),
'foreign keys' => array(
- 'uid' => array('users' => 'uid'),
+ 'user' => array(
+ 'table' => 'users',
+ 'columns' => array('uid' => 'uid'),
+ ),
),
);
@@ -78,7 +81,10 @@ function user_schema() {
'permission' => array('permission'),
),
'foreign keys' => array(
- 'rid' => array('role' => 'rid'),
+ 'role' => array(
+ 'table' => 'roles',
+ 'columns' => array('rid' => 'rid'),
+ ),
),
);
@@ -236,7 +242,10 @@ function user_schema() {
),
'primary key' => array('uid'),
'foreign keys' => array(
- 'signature_format' => array('filter_format' => 'format'),
+ 'signature_format' => array(
+ 'table' => 'filter_format',
+ 'columns' => array('signature_format' => 'format'),
+ ),
),
);
@@ -263,8 +272,14 @@ function user_schema() {
'rid' => array('rid'),
),
'foreign keys' => array(
- 'uid' => array('users' => 'uid'),
- 'rid' => array('role' => 'rid'),
+ 'user' => array(
+ 'table' => 'users',
+ 'columns' => array('uid' => 'uid'),
+ ),
+ 'role' => array(
+ 'table' => 'roles',
+ 'columns' => array('rid' => 'rid'),
+ ),
),
);