Commit 88c9a015 authored by Dries's avatar Dries

- Patch #111011 by Josh Waihi: adding foreign key specifications.

parent 43b201df
......@@ -100,24 +100,44 @@
*
* @code
* $schema['node'] = array(
* 'description' => 'The base table for nodes.',
* 'fields' => array(
* 'nid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
* 'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE),
* 'vid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
* 'type' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''),
* 'title' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''),
* 'nid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
* 'vid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE,'default' => 0),
* 'type' => array('type' => 'varchar','length' => 32,'not null' => TRUE, 'default' => ''),
* 'language' => array('type' => 'varchar','length' => 12,'not null' => TRUE,'default' => ''),
* 'title' => array('type' => 'varchar','length' => 255,'not null' => TRUE, 'default' => ''),
* 'uid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
* 'status' => array('type' => 'int', 'not null' => TRUE, 'default' => 1),
* 'created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
* 'changed' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
* 'comment' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
* 'promote' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
* 'moderate' => array('type' => 'int', 'not null' => TRUE,'default' => 0),
* 'sticky' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
* 'tnid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
* 'translate' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
* ),
* 'primary key' => array('nid'),
* 'unique keys' => array(
* 'vid' => array('vid')
* ),
* 'foreign keys' => array(
* 'uid' => array('users' => 'uid'),
* )
* 'indexes' => array(
* 'nid' => array('nid'),
* 'node_changed' => array('changed'),
* 'node_created' => array('created'),
* 'node_moderate' => array('moderate'),
* 'node_frontpage' => array('promote', 'status', 'sticky', 'created'),
* 'node_status_type' => array('status', 'type', 'nid'),
* 'node_title_type' => array('title', array('type', 4)),
* 'node_type' => array(array('type', 4)),
* 'uid' => array('uid'),
* 'tnid' => array('tnid'),
* 'translate' => array('translate'),
* ),
* 'unique keys' => array(
* 'vid' => array('vid'),
* ),
* 'foreign keys' => array(
* 'vid' => array('node_revision' => 'vid'),
* 'uid' => array('users' => 'uid'),
* ),
* 'primary key' => array('nid'),
* );
* @endcode
*
......
......@@ -1318,7 +1318,7 @@ function menu_get_active_help() {
}
// Add "more help" link on admin pages if the module provides a
// standalone help page.
if ($arg[0] == "admin" && module_exists('help') && $function('admin/help#' . $arg[2], $empty_arg) && $help) {
if ($arg[0] == "admin" && user_access('access administration pages') && module_exists('help') && $function('admin/help#' . $arg[2], $empty_arg) && $help) {
$output .= theme("more_help_link", url('admin/help/' . $arg[2]));
}
}
......
......@@ -89,6 +89,9 @@ function aggregator_schema() {
'indexes' => array(
'fid' => array('fid'),
),
'foreign keys' => array(
'cid' => array('aggregator_category' => 'cid'),
),
);
$schema['aggregator_category_item'] = array(
......@@ -111,6 +114,9 @@ function aggregator_schema() {
'indexes' => array(
'iid' => array('iid'),
),
'foreign keys' => array(
'cid' => array('aggregator_category' => 'cid'),
),
);
$schema['aggregator_feed'] = array(
......@@ -258,6 +264,9 @@ function aggregator_schema() {
'indexes' => array(
'fid' => array('fid'),
),
'foreign keys' => array(
'fid' => array('aggregator_feed' => 'fid'),
),
);
return $schema;
......
......@@ -60,6 +60,9 @@ function blogapi_schema() {
'indexes' => array(
'uid' => array('uid'),
),
'foreign keys' => array(
'uid' => array('users' => 'uid'),
),
);
return $schema;
......
......@@ -261,6 +261,9 @@ function comment_schema() {
'status' => array('status'),
),
'primary key' => array('cid'),
'foreign keys' => array(
'nid' => array('node' => 'nid'),
),
);
$schema['node_comment_statistics'] = array(
......@@ -303,6 +306,9 @@ function comment_schema() {
'indexes' => array(
'node_comment_timestamp' => array('last_comment_timestamp'),
),
'foreign keys' => array(
'nid' => array('node' => 'nid'),
),
);
return $schema;
......
......@@ -99,6 +99,10 @@ function forum_schema() {
'tid' => array('tid'),
),
'primary key' => array('vid'),
'foreign keys' => array(
'nid' => array('node' => 'nid'),
'vid' => array('node' => 'vid'),
),
);
return $schema;
......
......@@ -431,6 +431,9 @@ function locale_schema() {
),
),
'primary key' => array('language', 'lid', 'plural'),
'foreign keys' => array(
'lid' => array('locales_source' => 'lid'),
),
'indexes' => array(
'lid' => array('lid'),
'plid' => array('plid'),
......
......@@ -124,6 +124,10 @@ function node_schema() {
'unique keys' => array(
'vid' => array('vid'),
),
'foreign keys' => array(
'vid' => array('node_revision' => 'vid'),
'uid' => array('users' => 'uid'),
),
'primary key' => array('nid'),
);
......@@ -177,6 +181,7 @@ function node_schema() {
),
),
'primary key' => array('nid', 'gid', 'realm'),
'foreign keys' => array('node' => 'nid'),
);
$schema['node_revision'] = array(
......@@ -244,6 +249,10 @@ function node_schema() {
'uid' => array('uid'),
),
'primary key' => array('vid'),
'foreign keys' => array(
'node' => 'nid',
'users' => 'uid'
),
);
$schema['node_type'] = array(
......
......@@ -51,6 +51,9 @@ function poll_schema() {
),
),
'primary key' => array('nid'),
'foreign keys' => array(
'nid' => array('node' => 'nid'),
),
);
$schema['poll_choice'] = array(
......@@ -94,6 +97,9 @@ function poll_schema() {
'nid' => array('nid'),
),
'primary key' => array('chid'),
'foreign keys' => array(
'nid' => array('node' => 'nid'),
),
);
$schema['poll_vote'] = array(
......@@ -133,6 +139,10 @@ function poll_schema() {
),
),
'primary key' => array('nid', 'uid', 'hostname'),
'foreign keys' => array(
'nid' => array('node' => 'nid'),
'uid' => array('users' => 'uid'),
),
'indexes' => array(
'chid' => array('chid'),
'hostname' => array('hostname'),
......
......@@ -149,6 +149,10 @@ function profile_schema() {
'indexes' => array(
'fid' => array('fid'),
),
'foreign keys' => array(
'fid' => array('profile_field' => 'fid'),
'uid' => array('users' => 'uid'),
),
);
return $schema;
......
......@@ -95,6 +95,10 @@ function search_schema() {
'indexes' => array(
'sid_type' => array('sid', 'type'),
),
'foreign keys' => array(
'sid' => array('search_dataset' => 'sid'),
'type' => array('search_dataset' => 'type'),
),
'primary key' => array('word', 'sid', 'type'),
);
......
......@@ -100,6 +100,9 @@ function statistics_schema() {
'uid' => array('uid'),
),
'primary key' => array('aid'),
'foreign keys' => array(
'uid' => array('users' => 'uid'),
),
);
$schema['node_counter'] = array(
......
......@@ -681,6 +681,9 @@ function system_schema() {
'timestamp' => array('timestamp'),
),
'primary key' => array('fid'),
'foreign keys' => array(
'uid' => array('users' => 'uid'),
),
);
$schema['flood'] = array(
......@@ -1237,6 +1240,9 @@ function system_schema() {
'timestamp' => array('timestamp'),
'uid' => array('uid'),
),
'foreign keys' => array(
'uid' => array('users' => 'uid'),
),
);
$schema['system'] = array(
......
......@@ -68,6 +68,9 @@ function taxonomy_schema() {
),
),
'primary key' => array('tid'),
'foreign keys' => array(
'vid' => array('taxonomy_vocabulary' => 'vid'),
),
'indexes' => array(
'taxonomy_tree' => array('vid', 'weight', 'name'),
'vid_name' => array('vid', 'name'),
......@@ -95,6 +98,9 @@ function taxonomy_schema() {
'indexes' => array(
'parent' => array('parent'),
),
'foreign keys' => array(
'tid' => array('taxonomy_term_data' => 'tid'),
),
'primary key' => array('tid', 'parent'),
);
......@@ -127,6 +133,11 @@ function taxonomy_schema() {
'vid' => array('vid'),
'nid' => array('nid'),
),
'foreign keys' => array(
'nid' => array('node' => 'nid'),
'vid' => array('node' => 'vid'),
'tid' => array('taxonomy_term_data' => 'tid'),
),
'primary key' => array('tid', 'vid'),
);
......@@ -159,6 +170,10 @@ function taxonomy_schema() {
'indexes' => array(
'tid2' => array('tid2'),
),
'foreign keys' => array(
'tid1' => array('taxonomy_term_data' => 'tid'),
'tid2' => array('taxonomy_term_data' => 'tid'),
),
'primary key' => array('trid'),
);
......@@ -189,6 +204,9 @@ function taxonomy_schema() {
'tid' => array('tid'),
'name_tid' => array('name', 'tid'),
),
'foreign keys' => array(
'tid' => array('taxonomy_term_data' => 'tid'),
),
'primary key' => array('tsid'),
);
......@@ -304,6 +322,9 @@ function taxonomy_schema() {
'indexes' => array(
'vid' => array('vid'),
),
'foreign keys' => array(
'vid' => array('taxonomy_vocabulary' => 'vid'),
),
);
return $schema;
......
......@@ -61,6 +61,9 @@ function trigger_schema() {
),
),
'primary key' => array('hook', 'op', 'aid'),
'foreign keys' => array(
'aid' => array('actions' => 'aid'),
),
);
return $schema;
}
......
......@@ -83,6 +83,11 @@ function upload_schema() {
),
),
'primary key' => array('vid', 'fid'),
'foreign keys' => array(
'fid' => array('files' => 'fid'),
'nid' => array('node' => 'nid'),
'vid' => array('node' => 'vid'),
),
'indexes' => array(
'fid' => array('fid'),
'nid' => array('nid'),
......
......@@ -44,6 +44,9 @@ function user_schema() {
'authname' => array('authname'),
),
'primary key' => array('aid'),
'foreign keys' => array(
'uid' => array('users' => 'uid'),
),
);
$schema['role_permission'] = array(
......@@ -67,6 +70,9 @@ function user_schema() {
'indexes' => array(
'permission' => array('permission'),
),
'foreign keys' => array(
'rid' => array('role' => 'rid'),
),
);
$schema['role'] = array(
......@@ -228,6 +234,10 @@ function user_schema() {
'indexes' => array(
'rid' => array('rid'),
),
'foreign keys' => array(
'uid' => array('users' => 'uid'),
'rid' => array('role' => 'rid'),
),
);
return $schema;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment