Index: install.php =================================================================== RCS file: /cvs/drupal/drupal/install.php,v retrieving revision 1.41 diff -u -F^f -r1.41 install.php --- install.php 13 Apr 2007 08:56:57 -0000 1.41 +++ install.php 1 May 2007 01:13:26 -0000 @@ -39,12 +39,26 @@ function install_main() { } // Load module basics (needed for hook invokes). + // We load all modules that either are required during installation time + // or have models that need to be created include_once './includes/module.inc'; $module_list['system']['filename'] = 'modules/system/system.module'; $module_list['filter']['filename'] = 'modules/filter/filter.module'; + $module_list['block']['filename'] = 'modules/block/block.module'; + $module_list['user']['filename'] = 'modules/user/user.module'; + $module_list['node']['filename'] = 'modules/node/node.module'; + $module_list['comment']['filename'] = 'modules/comment/comment.module'; + $module_list['taxonomy']['filename'] = 'modules/taxonomy/taxonomy.module'; module_list(TRUE, FALSE, FALSE, $module_list); drupal_load('module', 'system'); drupal_load('module', 'filter'); + drupal_load('module', 'block'); + drupal_load('module', 'user'); + drupal_load('module', 'node'); + drupal_load('module', 'comment'); + drupal_load('module', 'taxonomy'); + drupal_load('module', 'system'); + drupal_load('module', 'filter'); // Decide which profile to use. if (!empty($_GET['profile'])) { Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.637 diff -u -F^f -r1.637 common.inc --- includes/common.inc 30 Apr 2007 11:12:35 -0000 1.637 +++ includes/common.inc 1 May 2007 01:13:27 -0000 @@ -2498,6 +2498,165 @@ function drupal_common_themes() { } /** + * Get the data schema of a table. + * + * A drupal schema definition is a representation of a data structure. + * A schema is defined in a callback function (similar to FAPI). + * This callback function, schema_schemaid(), should return an associative array that + * describes the data structure of the schema (table). The following keys will be + * processed during table creation: + * - ['table']: The table name. Defaults to the schemaid. + * - ['fields']: An associative array ('fieldname' => details) that describes the fields + * of the model. In the details array, the following options are available: + * - ['type']: The drupal field type. See drupal_field_types() for available values. + * This is a collection of default properties for a field's type. All values can be overridden. + * - ['datatype']: The field's datatype: 'varchar', 'int', 'float', 'text', 'blob' or 'datetime'. + * NOTE: You should not set this manually, but instead use one of the drupal datatypes. + * - ['size']: The data size: 'tiny', 'small', 'medium', 'normal', 'big'. + * This decides which engine-specific datatype is used (e.g. TINYINT vs. INT). + * If not set, 'normal' is used (which would expand to INT resp. TEXT resp. BLOB). + * Not all sizes are available for all data types. See db_type_map() for possible combinations. + * - ['length']: The max. length (character types only) + * - ['not null']: If true, no NULL values will be allowed. Defaults to false. + * - ['default']: The default value. + * - ['unsigned'], ['auto_increment'] + * All options apart from 'type' are optional. + * - ['primary key']: An array of (one or more) field names that form the primary key + * - ['unique key']: An array of the form 'key_name' => array('field1' [, 'field2' [, 'field3']]) + * - ['indexes']: An array of the form 'index_name' => array('field1' [, 'field2' [, 'field3']]) + * + * @param $table The table for which a schema should be loaded + */ + +function drupal_get_schema($table) { + static $schemas = array(); + + if (isset($schemas[$table])) + return $schemas[$table]; + + $schema = _drupal_get_schema($table); + + if (!empty($schema)) { + $schemas[$table] = $schema; + return $schemas[$table]; + } + return false; +} + +function _drupal_get_schema($table) { + $schemainfo = drupal_get_tables_info(); + + if (!isset($schemainfo[$table])) { + return false; + } + + $info = $schemainfo[$table]; + + if (function_exists($info['callback'])) { + $schema = call_user_func_array($info['callback'], $info['callback arguments']); + } + // If the callback function is not existing, we try to include the schema file. + if (file_exists(drupal_get_path('module', $info['module']) .'/'. $info['file'])) { + require_once drupal_get_path('module', $info['module']) .'/'. $info['file']; + if (function_exists($info['callback'])) { + $schema = call_user_func_array($info['callback'], $info['callback arguments']); + } + } + + if (!isset($schema)) { + return false; + } + + // set some default schema properties + $defaults = array( + 'name' => $table, + 'table' => $table, + 'mysql_suffix' => "/*!40100 DEFAULT CHARACTER SET UTF8 */", + ); + $schema = array_merge($defaults, $schema); + + // merge in the default field properties + foreach ($schema['fields'] as $key => $field) { + $schema['fields'][$key] = drupal_process_field($field); + } + + return $schema; +} + +/** + * Get information about tables + */ +function drupal_get_tables_info() { + static $info; + + // only build the schema info once + if (!empty($info)) + return $info; + + $modules = module_implements('tables'); + foreach ($modules as $module) { + $schemas = module_invoke($module, 'tables'); + foreach ($schemas as $table => $details) { + if (!empty($details)) { + // if the value isn't an array, only default options are used. + if (!is_array($details)) + $details = array('schema' => $details); + + // set the module key + if (!isset($details['module'])) + $details['module'] = $module; + + // the default options are only based on the schema name and its module + $default_options = array( + 'file' => "$module.schemas", + 'callback' => "schema_". $details['schema'], + 'callback arguments' => array(), + ); + + // merge the default options with the specified ones + $info[$table] = array_merge($default_options, $details); + } + } + } + return $info; +} + +/** + * Default properties for field types. + * TODO: Maybe implement this as hook. + */ +function drupal_field_types() { + $types = array( + 'int' => array('datatype' => 'int', 'size' => 'normal', 'not null' => true,'default' => 0), + 'varchar' => array('datatype' => 'varchar', 'size' => 'normal', 'not null' => true, 'length' => 255, 'default' => ''), + 'text' => array('datatype' => 'text', 'size' => 'normal', 'not null' => true), + 'float' => array('datatype' => 'float', 'size' => 'normal', 'not null' => true), + 'blob' => array('datatype' => 'blob', 'size' => 'normal'), + 'datetime' => array('datatype' => 'datetime', 'size' => 'normal'), + ); + return $types; +} + +/** + * Merge in the default properties for a database field. + * + * @param $field + * The field definition from a table schema. + * @return + * The field definition with the type's default properties merged in. + */ +function drupal_process_field($field) { + $defaults = drupal_field_types(); + + if (!isset($defaults[$field['type']])) + return $field; + + $field = array_merge($defaults[$field['type']], $field); + + return $field; +} + +/** * Parse Drupal info file format. * * Files should use an ini-like format to specify values. Index: includes/database.mysql.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.mysql.inc,v retrieving revision 1.70 diff -u -F^f -r1.70 database.mysql.inc --- includes/database.mysql.inc 21 Apr 2007 18:08:41 -0000 1.70 +++ includes/database.mysql.inc 1 May 2007 01:13:27 -0000 @@ -445,6 +445,231 @@ function db_distinct_field($table, $fiel return preg_replace('/(SELECT.*)(?:'. $table .'\.|\s)(? $field) { + $query .= _db_create_field_sql($name, db_process_field($field)) . ", \n"; + } + + // Process keys & indexes. + if (!empty($schema['primary key'])) + $query .= " PRIMARY KEY (" . implode(', ', $schema['primary key']) . "), \n"; + + if (!empty($schema['unique keys'])) { + foreach ($schema['unique keys'] as $key => $fields) + $query .= " UNIQUE KEY $key (" . implode(', ', $fields) . "), \n"; + } + + if (!empty($schema['indexes'])) { + foreach ($schema['indexes'] as $index => $fields) + $query .= " INDEX $index (" . implode(', ', $fields) . "), \n"; + } + + $query = substr($query, 0, -3) . "\n) "; + + if (!empty($schema['mysql_suffix'])) { + $query .= $schema['mysql_suffix']; + } + + if ($execute) + return db_query($query); + else + return $query; +} + +/** + * Set database-engine specific properties for a field. + * + * @param $field + * A field description array, as specified in the data model documentation. + */ +function db_process_field($field) { + // set needed default properties for unset properties + if (!isset($field['not null'])) + $field['not null'] = false; + if (!isset($field['size'])) + $field['size'] = 'normal'; + + // Set the correct database-engine specific datatype + $map = db_type_map(); + $field['dbtype'] = $map[$field['datatype'] .":". $field['size']]; + + return $field; +} + +/** + * Create a SQL string for a field to be used in table creation or alteration. + * + * Before passing a field out of a schema definition into this function it has + * to be processed by db_process_field. + * + * @param $name + * Name of the field + * @param $details + * The field properties. At least $details['dbtype'] has to be set by now. + * Aditional properties are 'length', 'unsigned', 'not null', 'auto_increment', 'default' + */ +function _db_create_field_sql($name, $details) { + $query = "`" . $name . "` " . $details['dbtype']; + if (isset($details['length'])) + $query .= "(" . $details['length'] . ") "; + + if (!empty($details['unsigned'])) + $query .= " unsigned "; + + if (!empty($details['not null'])) + $query .= " NOT NULL "; + + if (!empty($details['auto_increment'])) + $query .= " auto_increment "; + + if (isset($details['default']) && $details['default'] !== false) + $query .= " DEFAULT '" . $details['default'] . "' "; + + if ($details['not null'] == false && (!isset($details['default']) || $details['default'] === false) ) + $query .= " DEFAULT NULL "; + + return substr($query, 0, -1); +} + +/** + * This maps a generic data type in combination with its data size + * to the engine-specific data type. + */ +function db_type_map() { + $map = array( + 'varchar:normal' => 'VARCHAR', + + 'text:small' => 'SMALLTEXT', + 'text:medium' => 'MEDIUMTEXT', + 'text:big' => 'LONGTEXT', + 'text:normal' => 'TEXT', + + 'serial:normal' => 'INT', + 'serial:big' => 'BIGINT', + + 'int:tiny' => 'TINYINT', + 'int:small' => 'SMALLINT', + 'int:medium' => 'MEDIUMINT', + 'int:big' => 'BIGINT', + 'int:normal' => 'INT', + + 'float:tiny' => 'FLOAT', + 'float:small' => 'FLOAT', + 'float:medium' => 'FLOAT', + 'float:big' => 'DOUBLE', + 'float:normal' => 'FLOAT', + + 'blob:normal' => 'BLOB', + 'blob:big' => 'LONGBLOB', + + 'datetime:normal' => 'DATETIME', + ); + return $map; +} + +/** +* Drop table. +* +* @param string $table +* The table to be dropped. +*/ +function db_drop_table($table) { + return db_query("DROP TABLE {". $table ."}"); +} + +/** +* Create index. +* +* @param $table +* The table to be altered. +* @param $name +* The index's name. +* @param $columns +* An array of column names +*/ +function db_create_index($table, $name, $columns) { + $query = 'ALTER TABLE {'. $table .'} ADD INDEX '. $name .' ('; + + foreach ($columns as $current) { + $query .= $current . ', '; + } + + $query = substr($query, 0, -2) . ')'; + + return db_query($query); +} + +/** +* Drop index. +* +* @param string $table +* The table to be altered. +* @param string $name +* Name of the index to be dropped. +*/ +function db_drop_index($table, $name) { + return db_query('ALTER TABLE '. $table .' DROP INDEX '. $name); +} + +/** +* Adds a new field to a table. +* +* @param $table +* Name of the table to be altered. +* @param $field +* Name of the field to be added. +* @param $info +* The field information array, as taken from a schema definition +*/ +function db_add_field($table, $field, $info) { + $query = 'ALTER TABLE {'. $table .'} ADD '. $field .' '; + $query .= _create_field_sql($field, $info); + return db_query($query); +} + +/** +* Drop field. +* +* @param string $table +* The table to be altered. +* @param string $field +* The field to be dropped. +*/ +function db_drop_field($table, $field) { + return db_query('ALTER TABLE {'. $table .'} DROP '. $field); +} + +/** + * Set default value for $column. + * + * @param $table + * @param $field + * The field to be altered. + * @param $default + * Default value to be set. + */ +function db_field_set_default($table, $field, $default) { + if ($default == NUll) { + $default = 'NULL'; + } + else { + $default = "'$default'"; + } + + return db_query("ALTER TABLE {". $table ."} ALTER COLUMN ". $field ." SET DEFAULT ". $default); +} + /** * @} End of "ingroup database". */ Index: modules/aggregator/aggregator.module =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.module,v retrieving revision 1.338 diff -u -F^f -r1.338 aggregator.module --- modules/aggregator/aggregator.module 30 Apr 2007 17:03:22 -0000 1.338 +++ modules/aggregator/aggregator.module 1 May 2007 01:13:28 -0000 @@ -1430,3 +1430,15 @@ function aggregator_filter_xss($value) { function _aggregator_items($count) { return format_plural($count, '1 item', '@count items'); } + + +function aggregator_tables() { + $tables = array( + 'aggregator_category' => 'aggregator_category', + 'aggregator_category_feed' => 'aggregator_category_feed', + 'aggregator_category_item' => 'aggregator_category_item', + 'aggregator_feed' => 'aggregator_feed', + 'aggregator_item' => 'aggregator_item', + ); + return $tables; +} Index: modules/aggregator/aggregator.schemas =================================================================== RCS file: modules/aggregator/aggregator.schemas diff -N modules/aggregator/aggregator.schemas --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/aggregator/aggregator.schemas 1 May 2007 01:13:28 -0000 @@ -0,0 +1,92 @@ + array('type' => 'int', 'default' => false, 'auto_increment' => true), + 'title' => array('type' => 'varchar'), + 'description' => array('type' => 'text', 'default' => false, 'size' => 'big'), + 'block' => array('type' => 'int', 'size' => 'tiny') + ); + + $schema['primary key'] = array('cid'); + $schema['unique keys'] = array('title' => array('title')); + + return $schema; +} + +function schema_aggregator_category_feed() { + $schema['name'] = 'aggregator_category_feed'; + $schema['fields'] = array( + 'fid' => array('type' => 'int'), + 'cid' => array('type' => 'int') + ); + + $schema['primary key'] = array( + 'fid', + 'cid' + ); + + return $schema; +} + +function schema_aggregator_category_item() { + $schema['name'] = 'aggregator_category_item'; + $schema['fields'] = array( + 'iid' => array('type' => 'int'), + 'cid' => array('type' => 'int') + ); + + $schema['primary key'] = array( + 'iid', + 'cid' + ); + + return $schema; +} + +function schema_aggregator_feed() { + $schema['name'] = 'aggregator_feed'; + $schema['fields'] = array( + 'fid' => array('type' => 'int', 'default' => false, 'auto_increment' => true), + 'title' => array('type' => 'varchar'), + 'url' => array('type' => 'varchar'), + 'refresh' => array('type' => 'int'), + 'checked' => array('type' => 'int'), + 'link' => array('type' => 'varchar'), + 'description' => array('type' => 'text', 'default' => false, 'size' => 'big'), + 'image' => array('type' => 'text', 'default' => false, 'size' => 'big'), + 'etag' => array('type' => 'varchar'), + 'modified' => array('type' => 'int'), + 'block' => array('type' => 'int', 'size' => 'tiny') + ); + + $schema['unique keys'] = array( + 'link' => array('url'), + 'title' => array('title') + ); + $schema['primary key'] = array('fid'); + + return $schema; +} + +function schema_aggregator_item() { + $schema['name'] = 'aggregator_item'; + $schema['fields'] = array( + 'iid' => array('type' => 'int', 'default' => false, 'auto_increment' => true), + 'fid' => array('type' => 'int'), + 'title' => array('type' => 'varchar'), + 'link' => array('type' => 'varchar'), + 'author' => array('type' => 'varchar'), + 'description' => array('type' => 'text', 'default' => false, 'size' => 'big'), + 'timestamp' => array('type' => 'int', 'not null' => false), + 'guid' => array('type' => 'varchar', 'not null' => false) + ); + + $schema['indexes'] = array('fid' => array('fid')); + $schema['primary key'] = array('iid'); + + return $schema; +} + Index: modules/block/block.module =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.module,v retrieving revision 1.258 diff -u -F^f -r1.258 block.module --- modules/block/block.module 30 Apr 2007 17:03:23 -0000 1.258 +++ modules/block/block.module 1 May 2007 01:13:29 -0000 @@ -750,3 +750,13 @@ function block_list($region) { } return $blocks[$region]; } + + +function block_tables() { + $tables = array( + 'blocks' => 'blocks', + 'blocks_roles' => 'blocks_roles', + 'boxes' => 'boxes', + ); + return $tables; +} Index: modules/block/block.schemas =================================================================== RCS file: modules/block/block.schemas diff -N modules/block/block.schemas --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/block/block.schemas 1 May 2007 01:13:29 -0000 @@ -0,0 +1,55 @@ + array('type' => 'varchar', 'length' => 64), + 'delta' => array('type' => 'varchar', 'length' => 32, 'default' => 0), + 'theme' => array('type' => 'varchar'), + 'status' => array('type' => 'int', 'size' => 'tiny'), + 'weight' => array('type' => 'int', 'size' => 'tiny'), + 'region' => array('type' => 'varchar', 'length' => 64, 'default' => 'left'), + 'custom' => array('type' => 'int', 'size' => 'tiny'), + 'throttle' => array('type' => 'int', 'size' => 'tiny'), + 'visibility' => array('type' => 'int', 'size' => 'tiny'), + 'pages' => array('type' => 'text', 'default' => false), + 'title' => array('type' => 'varchar', 'length' => 64) + ); + + + return $schema; +} + +function schema_blocks_roles() { + $schema['name'] = 'blocks_roles'; + $schema['fields'] = array( + 'module' => array('type' => 'varchar', 'length' => 64, 'default' => false), + 'delta' => array('type' => 'varchar', 'length' => 32, 'default' => false), + 'rid' => array('type' => 'int', 'unsigned' => true, 'default' => false) + ); + + $schema['primary key'] = array( + 'module', + 'delta', + 'rid' + ); + + return $schema; +} + +function schema_boxes() { + $schema['name'] = 'boxes'; + $schema['fields'] = array( + 'bid' => array('type' => 'int', 'default' => false), + 'body' => array('type' => 'text', 'not null' => false, 'size' => 'big'), + 'info' => array('type' => 'varchar', 'length' => 128), + 'format' => array('type' => 'int') + ); + + $schema['unique keys'] = array('info' => array('info')); + $schema['primary key'] = array('bid'); + + return $schema; +} + Index: modules/book/book.module =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.module,v retrieving revision 1.419 diff -u -F^f -r1.419 book.module --- modules/book/book.module 30 Apr 2007 17:03:24 -0000 1.419 +++ modules/book/book.module 1 May 2007 01:13:29 -0000 @@ -1005,3 +1005,11 @@ function book_help($section) { } + + +function book_tables() { + $tables = array( + 'book' => 'book', + ); + return $tables; +} Index: modules/book/book.schemas =================================================================== RCS file: modules/book/book.schemas diff -N modules/book/book.schemas --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/book/book.schemas 1 May 2007 01:13:29 -0000 @@ -0,0 +1,21 @@ + array('type' => 'int', 'unsigned' => true), + 'nid' => array('type' => 'int', 'unsigned' => true), + 'parent' => array('type' => 'int'), + 'weight' => array('type' => 'int', 'size' => 'tiny') + ); + + $schema['indexes'] = array( + 'nid' => array('nid'), + 'parent' => array('parent') + ); + $schema['primary key'] = array('vid'); + + return $schema; +} + Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.541 diff -u -F^f -r1.541 comment.module --- modules/comment/comment.module 30 Apr 2007 17:03:24 -0000 1.541 +++ modules/comment/comment.module 1 May 2007 01:13:30 -0000 @@ -2065,3 +2065,12 @@ function vancode2int($c = '00') { return base_convert(substr($c, 1), 36, 10); } + + +function comment_tables() { + $tables = array( + 'comments' => 'comments', + 'node_comment_statistics' => 'node_comment_statistics', + ); + return $tables; +} Index: modules/comment/comment.schemas =================================================================== RCS file: modules/comment/comment.schemas diff -N modules/comment/comment.schemas --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/comment/comment.schemas 1 May 2007 01:13:30 -0000 @@ -0,0 +1,49 @@ + array('type' => 'int', 'default' => false, 'auto_increment' => true), + 'pid' => array('type' => 'int'), + 'nid' => array('type' => 'int'), + 'uid' => array('type' => 'int'), + 'subject' => array('type' => 'varchar', 'length' => 64), + 'comment' => array('type' => 'text', 'default' => false, 'size' => 'big'), + 'hostname' => array('type' => 'varchar', 'length' => 128), + 'timestamp' => array('type' => 'int'), + 'score' => array('type' => 'int', 'size' => 'medium'), + 'status' => array('type' => 'int', 'unsigned' => true, 'size' => 'tiny'), + 'format' => array('type' => 'int'), + 'thread' => array('type' => 'varchar', 'default' => false), + 'users' => array('type' => 'text', 'not null' => false, 'size' => 'big'), + 'name' => array('type' => 'varchar', 'length' => 60, 'not null' => false), + 'mail' => array('type' => 'varchar', 'length' => 64, 'not null' => false), + 'homepage' => array('type' => 'varchar', 'not null' => false) + ); + + $schema['indexes'] = array( + 'lid' => array('nid'), + 'status' => array('status') + ); + $schema['primary key'] = array('cid'); + + return $schema; +} + +function schema_node_comment_statistics() { + $schema['name'] = 'node_comment_statistics'; + $schema['fields'] = array( + 'nid' => array('type' => 'int', 'unsigned' => true, 'default' => false, 'auto_increment' => true), + 'last_comment_timestamp' => array('type' => 'int'), + 'last_comment_name' => array('type' => 'varchar', 'length' => 60, 'not null' => false), + 'last_comment_uid' => array('type' => 'int'), + 'comment_count' => array('type' => 'int', 'unsigned' => true) + ); + + $schema['indexes'] = array('node_comment_timestamp' => array('last_comment_timestamp')); + $schema['primary key'] = array('nid'); + + return $schema; +} + Index: modules/contact/contact.module =================================================================== RCS file: /cvs/drupal/drupal/modules/contact/contact.module,v retrieving revision 1.83 diff -u -F^f -r1.83 contact.module --- modules/contact/contact.module 30 Apr 2007 17:03:24 -0000 1.83 +++ modules/contact/contact.module 1 May 2007 01:13:30 -0000 @@ -553,3 +553,11 @@ function contact_mail_page_submit($form_ return ''; } + + +function contact_tables() { + $tables = array( + 'contact' => 'contact', + ); + return $tables; +} Index: modules/contact/contact.schemas =================================================================== RCS file: modules/contact/contact.schemas diff -N modules/contact/contact.schemas --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/contact/contact.schemas 1 May 2007 01:13:31 -0000 @@ -0,0 +1,20 @@ + array('type' => 'int', 'unsigned' => true, 'default' => false, 'auto_increment' => true), + 'category' => array('type' => 'varchar'), + 'recipients' => array('type' => 'text', 'default' => false, 'size' => 'big'), + 'reply' => array('type' => 'text', 'default' => false, 'size' => 'big'), + 'weight' => array('type' => 'int', 'size' => 'tiny'), + 'selected' => array('type' => 'int', 'size' => 'tiny') + ); + + $schema['unique keys'] = array('category' => array('category')); + $schema['primary key'] = array('cid'); + + return $schema; +} + Index: modules/dblog/dblog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.module,v retrieving revision 1.5 diff -u -F^f -r1.5 dblog.module --- modules/dblog/dblog.module 30 Apr 2007 17:03:24 -0000 1.5 +++ modules/dblog/dblog.module 1 May 2007 01:13:31 -0000 @@ -452,3 +452,11 @@ function dblog_build_filter_query() { 'args' => $args, ); } + + +function dblog_tables() { + $tables = array( + 'watchdog' => 'watchdog', + ); + return $tables; +} Index: modules/dblog/dblog.schemas =================================================================== RCS file: modules/dblog/dblog.schemas diff -N modules/dblog/dblog.schemas --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/dblog/dblog.schemas 1 May 2007 01:13:31 -0000 @@ -0,0 +1,25 @@ + array('type' => 'int', 'default' => false, 'auto_increment' => true), + 'uid' => array('type' => 'int'), + 'type' => array('type' => 'varchar', 'length' => 16), + 'message' => array('type' => 'text', 'default' => false, 'size' => 'big'), + 'variables' => array('type' => 'text', 'default' => false, 'size' => 'big'), + 'severity' => array('type' => 'int', 'unsigned' => true, 'size' => 'tiny'), + 'link' => array('type' => 'varchar'), + 'location' => array('type' => 'text', 'default' => false), + 'referer' => array('type' => 'varchar', 'length' => 128), + 'hostname' => array('type' => 'varchar', 'length' => 128), + 'timestamp' => array('type' => 'int') + ); + + $schema['primary key'] = array('wid'); + $schema['indexes'] = array('type' => array('type')); + + return $schema; +} + Index: modules/drupal/drupal.module =================================================================== RCS file: /cvs/drupal/drupal/modules/drupal/drupal.module,v retrieving revision 1.144 diff -u -F^f -r1.144 drupal.module --- modules/drupal/drupal.module 30 Apr 2007 17:03:24 -0000 1.144 +++ modules/drupal/drupal.module 1 May 2007 01:13:31 -0000 @@ -395,3 +395,12 @@ function drupal_login($username, $passwo } } } + + +function drupal_tables() { + $tables = array( + 'client' => 'client', + 'client_system' => 'client_system', + ); + return $tables; +} Index: modules/drupal/drupal.schemas =================================================================== RCS file: modules/drupal/drupal.schemas diff -N modules/drupal/drupal.schemas --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/drupal/drupal.schemas 1 May 2007 01:13:31 -0000 @@ -0,0 +1,40 @@ + array('type' => 'int', 'unsigned' => true, 'default' => false, 'auto_increment' => true), + 'link' => array('type' => 'varchar'), + 'name' => array('type' => 'varchar', 'length' => 128), + 'mail' => array('type' => 'varchar', 'length' => 128), + 'slogan' => array('type' => 'text', 'default' => false, 'size' => 'big'), + 'mission' => array('type' => 'text', 'default' => false, 'size' => 'big'), + 'users' => array('type' => 'int'), + 'nodes' => array('type' => 'int'), + 'version' => array('type' => 'varchar', 'length' => 35), + 'created' => array('type' => 'int'), + 'changed' => array('type' => 'int') + ); + + $schema['primary key'] = array('cid'); + + return $schema; +} + +function schema_client_system() { + $schema['name'] = 'client_system'; + $schema['fields'] = array( + 'cid' => array('type' => 'int'), + 'name' => array('type' => 'varchar'), + 'type' => array('type' => 'varchar') + ); + + $schema['primary key'] = array( + 'cid', + 'name' + ); + + return $schema; +} + Index: modules/filter/filter.module =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v retrieving revision 1.172 diff -u -F^f -r1.172 filter.module --- modules/filter/filter.module 30 Apr 2007 17:03:24 -0000 1.172 +++ modules/filter/filter.module 1 May 2007 01:13:32 -0000 @@ -1474,3 +1474,12 @@ function filter_xss_bad_protocol($string * @} End of "Standard filters". */ + + +function filter_tables() { + $tables = array( + 'filters' => 'filters', + 'filter_formats' => 'filter_formats', + ); + return $tables; +} Index: modules/filter/filter.schemas =================================================================== RCS file: modules/filter/filter.schemas diff -N modules/filter/filter.schemas --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/filter/filter.schemas 1 May 2007 01:13:32 -0000 @@ -0,0 +1,32 @@ + array('type' => 'int'), + 'module' => array('type' => 'varchar', 'length' => 64), + 'delta' => array('type' => 'int', 'size' => 'tiny'), + 'weight' => array('type' => 'int', 'size' => 'tiny') + ); + + $schema['indexes'] = array('weight' => array('weight')); + + return $schema; +} + +function schema_filter_formats() { + $schema['name'] = 'filter_formats'; + $schema['fields'] = array( + 'format' => array('type' => 'int', 'default' => false, 'auto_increment' => true), + 'name' => array('type' => 'varchar'), + 'roles' => array('type' => 'varchar'), + 'cache' => array('type' => 'int', 'size' => 'tiny') + ); + + $schema['unique keys'] = array('name' => array('name')); + $schema['primary key'] = array('format'); + + return $schema; +} + Index: modules/forum/forum.module =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v retrieving revision 1.395 diff -u -F^f -r1.395 forum.module --- modules/forum/forum.module 30 Apr 2007 17:03:25 -0000 1.395 +++ modules/forum/forum.module 1 May 2007 01:13:32 -0000 @@ -1185,3 +1185,11 @@ function _forum_get_topic_order_sql($sor } + + +function forum_tables() { + $tables = array( + 'forum' => 'forum', + ); + return $tables; +} Index: modules/forum/forum.schemas =================================================================== RCS file: modules/forum/forum.schemas diff -N modules/forum/forum.schemas --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/forum/forum.schemas 1 May 2007 01:13:32 -0000 @@ -0,0 +1,20 @@ + array('type' => 'int', 'unsigned' => true), + 'vid' => array('type' => 'int', 'unsigned' => true), + 'tid' => array('type' => 'int', 'unsigned' => true) + ); + + $schema['indexes'] = array( + 'nid' => array('nid'), + 'tid' => array('tid') + ); + $schema['primary key'] = array('vid'); + + return $schema; +} + Index: modules/locale/locale.module =================================================================== RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v retrieving revision 1.170 diff -u -F^f -r1.170 locale.module --- modules/locale/locale.module 30 Apr 2007 17:03:25 -0000 1.170 +++ modules/locale/locale.module 1 May 2007 01:13:33 -0000 @@ -507,3 +507,13 @@ function locale_admin_string_delete($lid include_once './includes/locale.inc'; _locale_string_delete($lid); } + + +function locale_tables() { + $tables = array( + 'languages' => 'languages', + 'locales_source' => 'locales_source', + 'locales_target' => 'locales_target', + ); + return $tables; +} Index: modules/locale/locale.schemas =================================================================== RCS file: modules/locale/locale.schemas diff -N modules/locale/locale.schemas --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/locale/locale.schemas 1 May 2007 01:13:33 -0000 @@ -0,0 +1,57 @@ + array('type' => 'varchar', 'length' => 12), + 'name' => array('type' => 'varchar', 'length' => 64), + 'native' => array('type' => 'varchar', 'length' => 64), + 'direction' => array('type' => 'int'), + 'enabled' => array('type' => 'int'), + 'plurals' => array('type' => 'int'), + 'formula' => array('type' => 'varchar', 'length' => 128), + 'domain' => array('type' => 'varchar', 'length' => 128), + 'prefix' => array('type' => 'varchar', 'length' => 128), + 'weight' => array('type' => 'int') + ); + + $schema['primary key'] = array('language'); + + return $schema; +} + +function schema_locales_source() { + $schema['name'] = 'locales_source'; + $schema['fields'] = array( + 'lid' => array('type' => 'int', 'default' => false, 'auto_increment' => true), + 'location' => array('type' => 'varchar'), + 'source' => array('type' => 'blob', 'not null' => true, 'default' => false) + ); + + $schema['primary key'] = array('lid'); + $schema['indexes'] = array('source' => array('source')); + + return $schema; +} + +function schema_locales_target() { + $schema['name'] = 'locales_target'; + $schema['fields'] = array( + 'lid' => array('type' => 'int'), + 'translation' => array('type' => 'blob', 'not null' => true, 'default' => false), + 'language' => array('type' => 'varchar', 'length' => 12), + 'plid' => array('type' => 'int'), + 'plural' => array('type' => 'int') + ); + + $schema['indexes'] = array( + 'lang' => array('language'), + 'lid' => array('lid'), + 'plid' => array('plid'), + 'plural' => array('plural') + ); + + return $schema; +} + Index: modules/menu/menu.module =================================================================== RCS file: /cvs/drupal/drupal/modules/menu/menu.module,v retrieving revision 1.109 diff -u -F^f -r1.109 menu.module --- modules/menu/menu.module 30 Apr 2007 17:03:25 -0000 1.109 +++ modules/menu/menu.module 1 May 2007 01:13:33 -0000 @@ -756,3 +756,11 @@ function _menu_overview_tree() { } return $output; } + + +function menu_tables() { + $tables = array( + 'menu_custom' => 'menu_custom', + ); + return $tables; +} Index: modules/menu/menu.schemas =================================================================== RCS file: modules/menu/menu.schemas diff -N modules/menu/menu.schemas --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/menu/menu.schemas 1 May 2007 01:13:33 -0000 @@ -0,0 +1,21 @@ + array('type' => 'varchar'), + 'disabled' => array('type' => 'int'), + 'title' => array('type' => 'varchar'), + 'description' => array('type' => 'varchar'), + 'weight' => array('type' => 'int'), + 'type' => array('type' => 'int'), + 'admin' => array('type' => 'int'), + 'parent' => array('type' => 'varchar') + ); + + $schema['primary key'] = array('path'); + + return $schema; +} + Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.806 diff -u -F^f -r1.806 node.module --- modules/node/node.module 30 Apr 2007 17:03:26 -0000 1.806 +++ modules/node/node.module 1 May 2007 01:13:34 -0000 @@ -3074,3 +3074,15 @@ function node_forms() { } return $forms; } + + +function node_tables() { + $tables = array( + 'node' => 'node', + 'node_access' => 'node_access', + 'node_counter' => 'node_counter', + 'node_revisions' => 'node_revisions', + 'node_type' => 'node_type', + ); + return $tables; +} Index: modules/node/node.schemas =================================================================== RCS file: modules/node/node.schemas diff -N modules/node/node.schemas --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/node/node.schemas 1 May 2007 01:13:34 -0000 @@ -0,0 +1,123 @@ + array('type' => 'int', 'unsigned' => true, 'default' => false, 'auto_increment' => true), + 'vid' => array('type' => 'int', 'unsigned' => true), + 'type' => array('type' => 'varchar', 'length' => 32), + 'language' => array('type' => 'varchar', 'length' => 12), + 'title' => array('type' => 'varchar', 'length' => 128), + 'uid' => array('type' => 'int'), + 'status' => array('type' => 'int', 'default' => 1), + 'created' => array('type' => 'int'), + 'changed' => array('type' => 'int'), + 'comment' => array('type' => 'int'), + 'promote' => array('type' => 'int'), + 'moderate' => array('type' => 'int'), + 'sticky' => array('type' => 'int') + ); + + $schema['indexes'] = array( + 'nid' => array('nid'), + 'node_changed' => array('changed'), + 'node_created' => array('created'), + 'node_moderate' => array('moderate'), + 'node_promote_status' => array('promote', 'status'), + 'node_status_type' => array('status', 'type', 'nid'), + 'node_title_type' => array('title', 'type'), + 'node_type' => array('type'), + 'status' => array('status'), + 'uid' => array('uid') + ); + $schema['primary key'] = array( + 'nid', + 'vid' + ); + $schema['unique keys'] = array('vid' => array('vid')); + + return $schema; +} + +function schema_node_access() { + $schema['name'] = 'node_access'; + $schema['fields'] = array( + 'nid' => array('type' => 'int', 'unsigned' => true), + 'gid' => array('type' => 'int', 'unsigned' => true), + 'realm' => array('type' => 'varchar'), + 'grant_view' => array('type' => 'int', 'unsigned' => true, 'size' => 'tiny'), + 'grant_update' => array('type' => 'int', 'unsigned' => true, 'size' => 'tiny'), + 'grant_delete' => array('type' => 'int', 'unsigned' => true, 'size' => 'tiny') + ); + + $schema['primary key'] = array( + 'nid', + 'gid', + 'realm' + ); + + return $schema; +} + +function schema_node_counter() { + $schema['name'] = 'node_counter'; + $schema['fields'] = array( + 'nid' => array('type' => 'int'), + 'totalcount' => array('type' => 'int', 'unsigned' => true, 'size' => 'big'), + 'daycount' => array('type' => 'int', 'unsigned' => true, 'size' => 'medium'), + 'timestamp' => array('type' => 'int', 'unsigned' => true) + ); + + $schema['primary key'] = array('nid'); + + return $schema; +} + +function schema_node_revisions() { + $schema['name'] = 'node_revisions'; + $schema['fields'] = array( + 'nid' => array('type' => 'int', 'unsigned' => true, 'default' => false), + 'vid' => array('type' => 'int', 'unsigned' => true, 'default' => false), + 'uid' => array('type' => 'int'), + 'title' => array('type' => 'varchar', 'length' => 128), + 'body' => array('type' => 'text', 'default' => false, 'size' => 'big'), + 'teaser' => array('type' => 'text', 'default' => false, 'size' => 'big'), + 'log' => array('type' => 'text', 'default' => false, 'size' => 'big'), + 'timestamp' => array('type' => 'int'), + 'format' => array('type' => 'int') + ); + + $schema['indexes'] = array( + 'nid' => array('nid'), + 'uid' => array('uid') + ); + $schema['primary key'] = array('vid'); + + return $schema; +} + +function schema_node_type() { + $schema['name'] = 'node_type'; + $schema['fields'] = array( + 'type' => array('type' => 'varchar', 'length' => 32, 'default' => false), + 'name' => array('type' => 'varchar'), + 'module' => array('type' => 'varchar', 'default' => false), + 'description' => array('type' => 'text', 'default' => false, 'size' => 'medium'), + 'help' => array('type' => 'text', 'default' => false, 'size' => 'medium'), + 'has_title' => array('type' => 'int', 'unsigned' => true, 'default' => false, 'size' => 'tiny'), + 'title_label' => array('type' => 'varchar'), + 'has_body' => array('type' => 'int', 'unsigned' => true, 'default' => false, 'size' => 'tiny'), + 'body_label' => array('type' => 'varchar'), + 'min_word_count' => array('type' => 'int', 'unsigned' => true, 'default' => false, 'size' => 'small'), + 'custom' => array('type' => 'int', 'size' => 'tiny'), + 'modified' => array('type' => 'int', 'size' => 'tiny'), + 'locked' => array('type' => 'int', 'size' => 'tiny'), + 'orig_type' => array('type' => 'varchar') + ); + + $schema['primary key'] = array('type'); + + return $schema; +} + Index: modules/poll/poll.module =================================================================== RCS file: /cvs/drupal/drupal/modules/poll/poll.module,v retrieving revision 1.227 diff -u -F^f -r1.227 poll.module --- modules/poll/poll.module 30 Apr 2007 17:03:27 -0000 1.227 +++ modules/poll/poll.module 1 May 2007 01:13:35 -0000 @@ -660,3 +660,13 @@ function poll_user($op, &$edit, &$user) db_query('UPDATE {poll_votes} SET uid = 0 WHERE uid = %d', $user->uid); } } + + +function poll_tables() { + $tables = array( + 'poll' => 'poll', + 'poll_choices' => 'poll_choices', + 'poll_votes' => 'poll_votes', + ); + return $tables; +} Index: modules/poll/poll.schemas =================================================================== RCS file: modules/poll/poll.schemas diff -N modules/poll/poll.schemas --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/poll/poll.schemas 1 May 2007 01:13:35 -0000 @@ -0,0 +1,50 @@ + array('type' => 'int', 'unsigned' => true), + 'runtime' => array('type' => 'int'), + 'active' => array('type' => 'int', 'unsigned' => true) + ); + + $schema['primary key'] = array('nid'); + + return $schema; +} + +function schema_poll_choices() { + $schema['name'] = 'poll_choices'; + $schema['fields'] = array( + 'chid' => array('type' => 'int', 'unsigned' => true, 'default' => false, 'auto_increment' => true), + 'nid' => array('type' => 'int', 'unsigned' => true), + 'chtext' => array('type' => 'varchar', 'length' => 128), + 'chvotes' => array('type' => 'int'), + 'chorder' => array('type' => 'int') + ); + + $schema['indexes'] = array('nid' => array('nid')); + $schema['primary key'] = array('chid'); + + return $schema; +} + +function schema_poll_votes() { + $schema['name'] = 'poll_votes'; + $schema['fields'] = array( + 'nid' => array('type' => 'int', 'unsigned' => true, 'default' => false), + 'uid' => array('type' => 'int', 'unsigned' => true), + 'chorder' => array('type' => 'int', 'default' => -1), + 'hostname' => array('type' => 'varchar', 'length' => 128) + ); + + $schema['indexes'] = array( + 'hostname' => array('hostname'), + 'nid' => array('nid'), + 'uid' => array('uid') + ); + + return $schema; +} + Index: modules/profile/profile.module =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v retrieving revision 1.200 diff -u -F^f -r1.200 profile.module --- modules/profile/profile.module 30 Apr 2007 17:03:27 -0000 1.200 +++ modules/profile/profile.module 1 May 2007 01:13:35 -0000 @@ -862,3 +862,12 @@ function profile_admin_settings_autocomp print drupal_to_js($matches); exit(); } + + +function profile_tables() { + $tables = array( + 'profile_fields' => 'profile_fields', + 'profile_values' => 'profile_values', + ); + return $tables; +} Index: modules/profile/profile.schemas =================================================================== RCS file: modules/profile/profile.schemas diff -N modules/profile/profile.schemas --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/profile/profile.schemas 1 May 2007 01:13:35 -0000 @@ -0,0 +1,44 @@ + array('type' => 'int', 'default' => false, 'auto_increment' => true), + 'title' => array('type' => 'varchar', 'not null' => false), + 'name' => array('type' => 'varchar', 'length' => 128, 'not null' => false), + 'explanation' => array('type' => 'text', 'not null' => false), + 'category' => array('type' => 'varchar', 'not null' => false), + 'page' => array('type' => 'varchar', 'not null' => false), + 'type' => array('type' => 'varchar', 'length' => 128, 'not null' => false), + 'weight' => array('type' => 'int', 'size' => 'tiny'), + 'required' => array('type' => 'int', 'size' => 'tiny'), + 'register' => array('type' => 'int', 'size' => 'tiny'), + 'visibility' => array('type' => 'int', 'size' => 'tiny'), + 'autocomplete' => array('type' => 'int', 'size' => 'tiny'), + 'options' => array('type' => 'text', 'not null' => false) + ); + + $schema['indexes'] = array('category' => array('category')); + $schema['unique keys'] = array('name' => array('name')); + $schema['primary key'] = array('fid'); + + return $schema; +} + +function schema_profile_values() { + $schema['name'] = 'profile_values'; + $schema['fields'] = array( + 'fid' => array('type' => 'int', 'unsigned' => true, 'not null' => false), + 'uid' => array('type' => 'int', 'unsigned' => true, 'not null' => false), + 'value' => array('type' => 'text', 'not null' => false) + ); + + $schema['indexes'] = array( + 'fid' => array('fid'), + 'uid' => array('uid') + ); + + return $schema; +} + Index: modules/search/search.module =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.module,v retrieving revision 1.220 diff -u -F^f -r1.220 search.module --- modules/search/search.module 30 Apr 2007 17:03:27 -0000 1.220 +++ modules/search/search.module 1 May 2007 01:13:36 -0000 @@ -1317,3 +1317,13 @@ function search_forms() { ); return $forms; } + + +function search_tables() { + $tables = array( + 'search_dataset' => 'search_dataset', + 'search_index' => 'search_index', + 'search_total' => 'search_total', + ); + return $tables; +} Index: modules/search/search.schemas =================================================================== RCS file: modules/search/search.schemas diff -N modules/search/search.schemas --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/search/search.schemas 1 May 2007 01:13:36 -0000 @@ -0,0 +1,48 @@ + array('type' => 'int', 'unsigned' => true), + 'type' => array('type' => 'varchar', 'length' => 16, 'not null' => false), + 'data' => array('type' => 'text', 'default' => false, 'size' => 'big') + ); + + $schema['indexes'] = array('sid_type' => array('sid', 'type')); + + return $schema; +} + +function schema_search_index() { + $schema['name'] = 'search_index'; + $schema['fields'] = array( + 'word' => array('type' => 'varchar', 'length' => 50), + 'sid' => array('type' => 'int', 'unsigned' => true), + 'type' => array('type' => 'varchar', 'length' => 16, 'not null' => false), + 'fromsid' => array('type' => 'int', 'unsigned' => true), + 'fromtype' => array('type' => 'varchar', 'length' => 16, 'not null' => false), + 'score' => array('type' => 'float', 'not null' => false) + ); + + $schema['indexes'] = array( + 'from_sid_type' => array('fromsid', 'fromtype'), + 'sid_type' => array('sid', 'type'), + 'word' => array('word') + ); + + return $schema; +} + +function schema_search_total() { + $schema['name'] = 'search_total'; + $schema['fields'] = array( + 'word' => array('type' => 'varchar', 'length' => 50), + 'count' => array('type' => 'float', 'not null' => false) + ); + + $schema['primary key'] = array('word'); + + return $schema; +} + Index: modules/statistics/statistics.module =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.module,v retrieving revision 1.258 diff -u -F^f -r1.258 statistics.module --- modules/statistics/statistics.module 30 Apr 2007 17:03:27 -0000 1.258 +++ modules/statistics/statistics.module 1 May 2007 01:13:36 -0000 @@ -558,3 +558,11 @@ function statistics_nodeapi(&$node, $op, } + + +function statistics_tables() { + $tables = array( + 'accesslog' => 'accesslog', + ); + return $tables; +} Index: modules/statistics/statistics.schemas =================================================================== RCS file: modules/statistics/statistics.schemas diff -N modules/statistics/statistics.schemas --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/statistics/statistics.schemas 1 May 2007 01:13:36 -0000 @@ -0,0 +1,23 @@ + array('type' => 'int', 'default' => false, 'auto_increment' => true), + 'sid' => array('type' => 'varchar', 'length' => 64), + 'title' => array('type' => 'varchar', 'not null' => false), + 'path' => array('type' => 'varchar', 'not null' => false), + 'url' => array('type' => 'varchar', 'not null' => false), + 'hostname' => array('type' => 'varchar', 'length' => 128, 'not null' => false), + 'uid' => array('type' => 'int', 'unsigned' => true, 'not null' => false), + 'timer' => array('type' => 'int', 'unsigned' => true), + 'timestamp' => array('type' => 'int', 'unsigned' => true) + ); + + $schema['indexes'] = array('accesslog_timestamp' => array('timestamp')); + $schema['primary key'] = array('aid'); + + return $schema; +} + Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.99 diff -u -F^f -r1.99 system.install --- modules/system/system.install 25 Apr 2007 21:34:32 -0000 1.99 +++ modules/system/system.install 1 May 2007 01:13:37 -0000 @@ -170,925 +170,22 @@ function system_requirements($phase) { * Implementation of hook_install(). */ function system_install() { - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - db_query("CREATE TABLE {access} ( - aid int NOT NULL auto_increment, - mask varchar(255) NOT NULL default '', - type varchar(255) NOT NULL default '', - status tinyint NOT NULL default '0', - PRIMARY KEY (aid) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {authmap} ( - aid int unsigned NOT NULL auto_increment, - uid int NOT NULL default '0', - authname varchar(128) NOT NULL default '', - module varchar(128) NOT NULL default '', - PRIMARY KEY (aid), - UNIQUE KEY authname (authname) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {blocks} ( - module varchar(64) DEFAULT '' NOT NULL, - delta varchar(32) NOT NULL default '0', - theme varchar(255) NOT NULL default '', - status tinyint DEFAULT '0' NOT NULL, - weight tinyint DEFAULT '0' NOT NULL, - region varchar(64) DEFAULT 'left' NOT NULL, - custom tinyint DEFAULT '0' NOT NULL, - throttle tinyint DEFAULT '0' NOT NULL, - visibility tinyint DEFAULT '0' NOT NULL, - pages text NOT NULL, - title varchar(64) DEFAULT '' NOT NULL - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {boxes} ( - bid int NOT NULL, - body longtext, - info varchar(128) NOT NULL default '', - format int NOT NULL default '0', - PRIMARY KEY (bid), - UNIQUE KEY info (info) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {cache} ( - cid varchar(255) NOT NULL default '', - data longblob, - expire int NOT NULL default '0', - created int NOT NULL default '0', - headers text, - serialized int(1) NOT NULL default '0', - PRIMARY KEY (cid), - INDEX expire (expire) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - db_query("CREATE TABLE {cache_filter} ( - cid varchar(255) NOT NULL default '', - data longblob, - expire int NOT NULL default '0', - created int NOT NULL default '0', - headers text, - serialized int(1) NOT NULL default '0', - PRIMARY KEY (cid), - INDEX expire (expire) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - db_query("CREATE TABLE {cache_page} ( - cid varchar(255) BINARY NOT NULL default '', - data longblob, - expire int NOT NULL default '0', - created int NOT NULL default '0', - headers text, - serialized int(1) NOT NULL default '0', - PRIMARY KEY (cid), - INDEX expire (expire) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {comments} ( - cid int NOT NULL auto_increment, - pid int NOT NULL default '0', - nid int NOT NULL default '0', - uid int NOT NULL default '0', - subject varchar(64) NOT NULL default '', - comment longtext NOT NULL, - hostname varchar(128) NOT NULL default '', - timestamp int NOT NULL default '0', - score mediumint NOT NULL default '0', - status tinyint unsigned NOT NULL default '0', - format int NOT NULL default '0', - thread varchar(255) NOT NULL, - users longtext, - name varchar(60) default NULL, - mail varchar(64) default NULL, - homepage varchar(255) default NULL, - PRIMARY KEY (cid), - KEY lid (nid), - KEY status (status) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {node_comment_statistics} ( - nid int unsigned NOT NULL auto_increment, - last_comment_timestamp int NOT NULL default '0', - last_comment_name varchar(60) default NULL, - last_comment_uid int NOT NULL default '0', - comment_count int unsigned NOT NULL default '0', - PRIMARY KEY (nid), - KEY node_comment_timestamp (last_comment_timestamp) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {files} ( - fid int unsigned NOT NULL default 0, - nid int unsigned NOT NULL default 0, - filename varchar(255) NOT NULL default '', - filepath varchar(255) NOT NULL default '', - filemime varchar(255) NOT NULL default '', - filesize int unsigned NOT NULL default 0, - PRIMARY KEY (fid), - KEY nid (nid) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {file_revisions} ( - fid int unsigned NOT NULL default 0, - vid int unsigned NOT NULL default 0, - description varchar(255) NOT NULL default '', - list tinyint unsigned NOT NULL default 0, - PRIMARY KEY (fid, vid), - KEY (vid) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {filter_formats} ( - format int NOT NULL auto_increment, - name varchar(255) NOT NULL default '', - roles varchar(255) NOT NULL default '', - cache tinyint NOT NULL default '0', - PRIMARY KEY (format), - UNIQUE KEY (name) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {filters} ( - format int NOT NULL default '0', - module varchar(64) NOT NULL default '', - delta tinyint DEFAULT '0' NOT NULL, - weight tinyint DEFAULT '0' NOT NULL, - INDEX (weight) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {flood} ( - event varchar(64) NOT NULL default '', - hostname varchar(128) NOT NULL default '', - timestamp int NOT NULL default '0' - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {history} ( - uid int NOT NULL default '0', - nid int NOT NULL default '0', - timestamp int NOT NULL default '0', - PRIMARY KEY (uid,nid) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {menu} ( - mid int NOT NULL default 0, - pid int NOT NULL default 0, - path varchar(255) NOT NULL default '', - load_functions varchar(255) NOT NULL default '', - to_arg_functions varchar(255) NOT NULL default '', - access_callback varchar(255) NOT NULL default '', - access_arguments text, - page_callback varchar(255) NOT NULL default '', - page_arguments text, - fit int NOT NULL default 0, - number_parts int NOT NULL default 0, - mleft int NOT NULL default 0, - mright int NOT NULL default 0, - visible int NOT NULL default 0, - parents varchar(255) NOT NULL default '', - depth int NOT NULL default 0, - has_children int NOT NULL default 0, - tab int NOT NULL default 0, - title varchar(255) NOT NULL default '', - title_callback varchar(255) NOT NULL default '', - title_arguments varchar(255) NOT NULL default '', - parent varchar(255) NOT NULL default '', - type int NOT NULL default 0, - block_callback varchar(255) NOT NULL default '', - description varchar(255) NOT NULL default '', - position varchar(255) NOT NULL default '', - link_path varchar(255) NOT NULL default '', - attributes varchar(255) NOT NULL default '', - query varchar(255) NOT NULL default '', - fragment varchar(255) NOT NULL default '', - absolute INT NOT NULL default 0, - html INT NOT NULL default 0, - PRIMARY KEY (path), - KEY fit (fit), - KEY visible (visible), - KEY pid (pid), - KEY parent (parent) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {node} ( - nid int unsigned NOT NULL auto_increment, - vid int unsigned NOT NULL default '0', - type varchar(32) NOT NULL default '', - language varchar(12) NOT NULL default '', - title varchar(128) NOT NULL default '', - uid int NOT NULL default '0', - status int NOT NULL default '1', - created int NOT NULL default '0', - changed int NOT NULL default '0', - comment int NOT NULL default '0', - promote int NOT NULL default '0', - moderate int NOT NULL default '0', - sticky int NOT NULL default '0', - PRIMARY KEY (nid, vid), - UNIQUE KEY vid (vid), - KEY node_type (type(4)), - KEY node_title_type (title, type(4)), - KEY status (status), - KEY uid (uid), - KEY node_moderate (moderate), - KEY node_promote_status (promote, status), - KEY node_created (created), - KEY node_changed (changed), - KEY node_status_type (status, type, nid), - KEY nid (nid) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {node_access} ( - nid int unsigned NOT NULL default '0', - gid int unsigned NOT NULL default '0', - realm varchar(255) NOT NULL default '', - grant_view tinyint unsigned NOT NULL default '0', - grant_update tinyint unsigned NOT NULL default '0', - grant_delete tinyint unsigned NOT NULL default '0', - PRIMARY KEY (nid,gid,realm) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {node_revisions} ( - nid int unsigned NOT NULL, - vid int unsigned NOT NULL, - uid int NOT NULL default '0', - title varchar(128) NOT NULL default '', - body longtext NOT NULL, - teaser longtext NOT NULL, - log longtext NOT NULL, - timestamp int NOT NULL default '0', - format int NOT NULL default '0', - PRIMARY KEY (vid), - KEY nid (nid), - KEY uid (uid) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {node_type} ( - type varchar(32) NOT NULL, - name varchar(255) NOT NULL default '', - module varchar(255) NOT NULL, - description mediumtext NOT NULL, - help mediumtext NOT NULL, - has_title tinyint unsigned NOT NULL, - title_label varchar(255) NOT NULL default '', - has_body tinyint unsigned NOT NULL, - body_label varchar(255) NOT NULL default '', - min_word_count smallint unsigned NOT NULL, - custom tinyint NOT NULL DEFAULT '0', - modified tinyint NOT NULL DEFAULT '0', - locked tinyint NOT NULL DEFAULT '0', - orig_type varchar(255) NOT NULL default '', - PRIMARY KEY (type) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {url_alias} ( - pid int unsigned NOT NULL auto_increment, - src varchar(128) NOT NULL default '', - dst varchar(128) NOT NULL default '', - language varchar(12) NOT NULL default '', - PRIMARY KEY (pid), - UNIQUE KEY dst_language (dst, language), - KEY src (src) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {permission} ( - rid int unsigned NOT NULL default '0', - perm longtext, - tid int unsigned NOT NULL default '0', - KEY rid (rid) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {role} ( - rid int unsigned NOT NULL auto_increment, - name varchar(64) NOT NULL default '', - PRIMARY KEY (rid), - UNIQUE KEY name (name) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {blocks_roles} ( - module varchar(64) NOT NULL, - delta varchar(32) NOT NULL, - rid int unsigned NOT NULL, - PRIMARY KEY (module, delta, rid) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {sessions} ( - uid int unsigned NOT NULL, - sid varchar(64) NOT NULL default '', - hostname varchar(128) NOT NULL default '', - timestamp int NOT NULL default '0', - cache int NOT NULL default '0', - session longtext, - KEY uid (uid), - PRIMARY KEY (sid), - KEY timestamp (timestamp) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {sequences} ( - name varchar(255) NOT NULL default '', - id int unsigned NOT NULL default '0', - PRIMARY KEY (name) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {node_counter} ( - nid int NOT NULL default '0', - totalcount bigint unsigned NOT NULL default '0', - daycount mediumint unsigned NOT NULL default '0', - timestamp int unsigned NOT NULL default '0', - PRIMARY KEY (nid) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {system} ( - filename varchar(255) NOT NULL default '', - name varchar(255) NOT NULL default '', - type varchar(255) NOT NULL default '', - owner varchar(255) NOT NULL default '', - status int NOT NULL default '0', - throttle tinyint DEFAULT '0' NOT NULL, - bootstrap int NOT NULL default '0', - schema_version smallint NOT NULL default -1, - weight int NOT NULL default '0', - info text, - PRIMARY KEY (filename), - KEY (weight) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {term_data} ( - tid int unsigned NOT NULL auto_increment, - vid int unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '', - description longtext, - weight tinyint NOT NULL default '0', - PRIMARY KEY (tid), - KEY vid (vid) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {term_hierarchy} ( - tid int unsigned NOT NULL default '0', - parent int unsigned NOT NULL default '0', - KEY tid (tid), - KEY parent (parent), - PRIMARY KEY (tid, parent) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {term_node} ( - nid int unsigned NOT NULL default '0', - vid int unsigned NOT NULL default '0', - tid int unsigned NOT NULL default '0', - KEY nid (nid), - KEY vid (vid), - KEY tid (tid), - PRIMARY KEY (vid,tid,nid) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {term_relation} ( - tid1 int unsigned NOT NULL default '0', - tid2 int unsigned NOT NULL default '0', - KEY tid1 (tid1), - KEY tid2 (tid2) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {term_synonym} ( - tid int unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '', - KEY tid (tid), - KEY name (name(3)) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {users} ( - uid int unsigned NOT NULL default '0', - name varchar(60) NOT NULL default '', - pass varchar(32) NOT NULL default '', - mail varchar(64) default '', - mode tinyint NOT NULL default '0', - sort tinyint default '0', - threshold tinyint default '0', - theme varchar(255) NOT NULL default '', - signature varchar(255) NOT NULL default '', - created int NOT NULL default '0', - access int NOT NULL default '0', - login int NOT NULL default '0', - status tinyint NOT NULL default '0', - timezone varchar(8) default NULL, - language varchar(12) NOT NULL default '', - picture varchar(255) NOT NULL DEFAULT '', - init varchar(64) default '', - data longtext, - PRIMARY KEY (uid), - UNIQUE KEY name (name), - KEY created (created), - KEY access (access) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {users_roles} ( - uid int unsigned NOT NULL default '0', - rid int unsigned NOT NULL default '0', - PRIMARY KEY (uid, rid) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {variable} ( - name varchar(128) NOT NULL default '', - value longtext NOT NULL, - language varchar(12) NOT NULL default '', - PRIMARY KEY (name, language) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {vocabulary} ( - vid int unsigned NOT NULL auto_increment, - name varchar(255) NOT NULL default '', - description longtext, - help varchar(255) NOT NULL default '', - relations tinyint unsigned NOT NULL default '0', - hierarchy tinyint unsigned NOT NULL default '0', - multiple tinyint unsigned NOT NULL default '0', - required tinyint unsigned NOT NULL default '0', - tags tinyint unsigned NOT NULL default '0', - module varchar(255) NOT NULL default '', - weight tinyint NOT NULL default '0', - PRIMARY KEY (vid) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - db_query("CREATE TABLE {vocabulary_node_types} ( - vid int unsigned NOT NULL DEFAULT '0', - type varchar(32) NOT NULL DEFAULT '', - PRIMARY KEY (vid, type) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - break; - case 'pgsql': - /* create unsigned types */ - db_query("CREATE DOMAIN int_unsigned integer CHECK (VALUE >= 0)"); - db_query("CREATE DOMAIN smallint_unsigned smallint CHECK (VALUE >= 0)"); - db_query("CREATE DOMAIN bigint_unsigned bigint CHECK (VALUE >= 0)"); - - /* create functions */ - db_query('CREATE OR REPLACE FUNCTION "greatest"(numeric, numeric) RETURNS numeric AS - \'SELECT CASE WHEN (($1 > $2) OR ($2 IS NULL)) THEN $1 ELSE $2 END;\' - LANGUAGE \'sql\'' - ); - db_query('CREATE OR REPLACE FUNCTION "greatest"(numeric, numeric, numeric) RETURNS numeric AS - \'SELECT greatest($1, greatest($2, $3));\' - LANGUAGE \'sql\'' - ); - if (!db_result(db_query("SELECT COUNT(*) FROM pg_proc WHERE proname = 'rand'"))) { - db_query('CREATE OR REPLACE FUNCTION "rand"() RETURNS float AS - \'SELECT random();\' - LANGUAGE \'sql\'' - ); - } - - if (!db_result(db_query("SELECT COUNT(*) FROM pg_proc WHERE proname = 'concat'"))) { - db_query('CREATE OR REPLACE FUNCTION "concat"(text, text) RETURNS text AS - \'SELECT $1 || $2;\' - LANGUAGE \'sql\'' - ); - } - db_query('CREATE OR REPLACE FUNCTION "if"(boolean, text, text) RETURNS text AS - \'SELECT CASE WHEN $1 THEN $2 ELSE $3 END;\' - LANGUAGE \'sql\'' - ); - db_query('CREATE OR REPLACE FUNCTION "if"(boolean, integer, integer) RETURNS integer AS - \'SELECT CASE WHEN $1 THEN $2 ELSE $3 END;\' - LANGUAGE \'sql\'' - ); - - /* create tables */ - db_query("CREATE TABLE {access} ( - aid serial, - mask varchar(255) NOT NULL default '', - type varchar(255) NOT NULL default '', - status smallint NOT NULL default '0', - PRIMARY KEY (aid) - )"); - - db_query("CREATE TABLE {authmap} ( - aid serial CHECK (aid >= 0), - uid int NOT NULL default '0', - authname varchar(128) NOT NULL default '', - module varchar(128) NOT NULL default '', - PRIMARY KEY (aid), - UNIQUE (authname) - )"); - - db_query("CREATE TABLE {blocks} ( - module varchar(64) DEFAULT '' NOT NULL, - delta varchar(32) NOT NULL default '0', - theme varchar(255) NOT NULL default '', - status smallint DEFAULT '0' NOT NULL, - weight smallint DEFAULT '0' NOT NULL, - region varchar(64) DEFAULT 'left' NOT NULL, - custom smallint DEFAULT '0' NOT NULL, - throttle smallint DEFAULT '0' NOT NULL, - visibility smallint DEFAULT '0' NOT NULL, - pages text DEFAULT '' NOT NULL, - title varchar(64) DEFAULT '' NOT NULL - )"); - - db_query("CREATE TABLE {boxes} ( - bid serial, - body text, - info varchar(128) NOT NULL default '', - format smallint NOT NULL default '0', - PRIMARY KEY (bid), - UNIQUE (info) - )"); - - db_query("CREATE TABLE {cache} ( - cid varchar(255) NOT NULL default '', - data bytea, - expire int NOT NULL default '0', - created int NOT NULL default '0', - headers text, - serialized int(1) NOT NULL default '0', - PRIMARY KEY (cid) - )"); - db_query("CREATE TABLE {cache_filter} ( - cid varchar(255) NOT NULL default '', - data bytea, - expire int NOT NULL default '0', - created int NOT NULL default '0', - headers text, - serialized int(1) NOT NULL default '0', - PRIMARY KEY (cid) - )"); - db_query("CREATE TABLE {cache_page} ( - cid varchar(255) NOT NULL default '', - data bytea, - expire int NOT NULL default '0', - created int NOT NULL default '0', - headers text, - serialized int(1) NOT NULL default '0', - PRIMARY KEY (cid) - )"); - db_query("CREATE INDEX {cache}_expire_idx ON {cache} (expire)"); - db_query("CREATE INDEX {cache_filter}_expire_idx ON {cache_filter} (expire)"); - db_query("CREATE INDEX {cache_page}_expire_idx ON {cache_page} (expire)"); - - db_query("CREATE TABLE {comments} ( - cid serial, - pid int NOT NULL default '0', - nid int NOT NULL default '0', - uid int NOT NULL default '0', - subject varchar(64) NOT NULL default '', - comment text NOT NULL, - hostname varchar(128) NOT NULL default '', - timestamp int NOT NULL default '0', - score int NOT NULL default '0', - status smallint_unsigned NOT NULL default '0', - format smallint NOT NULL default '0', - thread varchar(255) NOT NULL, - users text, - name varchar(60) default NULL, - mail varchar(64) default NULL, - homepage varchar(255) default NULL, - PRIMARY KEY (cid) - )"); - db_query("CREATE INDEX {comments}_nid_idx ON {comments} (nid)"); - db_query("CREATE INDEX {comments}_status_idx ON {comments} (status)"); - - db_query("CREATE TABLE {node_comment_statistics} ( - nid serial CHECK (nid >= 0), - last_comment_timestamp int NOT NULL default '0', - last_comment_name varchar(60) default NULL, - last_comment_uid int NOT NULL default '0', - comment_count int_unsigned NOT NULL default '0', - PRIMARY KEY (nid) - )"); - db_query("CREATE INDEX {node_comment_statistics}_node_comment_timestamp_idx ON {node_comment_statistics} (last_comment_timestamp)"); - - db_query("CREATE TABLE {files} ( - fid serial CHECK (fid >= 0), - nid int_unsigned NOT NULL default 0, - filename varchar(255) NOT NULL default '', - filepath varchar(255) NOT NULL default '', - filemime varchar(255) NOT NULL default '', - filesize int_unsigned NOT NULL default 0, - PRIMARY KEY (fid) - )"); - db_query("CREATE INDEX {files}_nid_idx ON {files} (nid)"); - - db_query("CREATE TABLE {file_revisions} ( - fid int_unsigned NOT NULL default 0, - vid int_unsigned NOT NULL default 0, - description varchar(255) NOT NULL default '', - list smallint_unsigned NOT NULL default 0, - PRIMARY KEY (fid, vid) - )"); - db_query("CREATE INDEX {file_revisions}_vid_idx ON {file_revisions} (vid)"); - - db_query("CREATE TABLE {filter_formats} ( - format serial, - name varchar(255) NOT NULL default '', - roles varchar(255) NOT NULL default '', - cache smallint NOT NULL default '0', - PRIMARY KEY (format), - UNIQUE (name) - )"); - - db_query("CREATE TABLE {filters} ( - format int NOT NULL default '0', - module varchar(64) NOT NULL default '', - delta smallint DEFAULT '0' NOT NULL, - weight smallint DEFAULT '0' NOT NULL - )"); - db_query("CREATE INDEX {filters}_weight_idx ON {filters} (weight)"); - - db_query("CREATE TABLE {flood} ( - event varchar(64) NOT NULL default '', - hostname varchar(128) NOT NULL default '', - timestamp int NOT NULL default '0' - )"); - - db_query("CREATE TABLE {history} ( - uid int NOT NULL default '0', - nid int NOT NULL default '0', - timestamp int NOT NULL default '0', - PRIMARY KEY (uid,nid) - )"); - - db_query("CREATE TABLE {menu} ( - mid int NOT NULL default 0, - pid int NOT NULL default 0, - path varchar(255) NOT NULL default '', - load_functions varchar(255) NOT NULL default '', - to_arg_functions varchar(255) NOT NULL default '', - access_callback varchar(255) NOT NULL default '', - access_arguments text, - page_callback varchar(255) NOT NULL default '', - page_arguments text, - fit int NOT NULL default 0, - number_parts int NOT NULL default 0, - mleft int NOT NULL default 0, - mright int NOT NULL default 0, - visible int NOT NULL default 0, - parents varchar(255) NOT NULL default '', - depth int NOT NULL default 0, - has_children int NOT NULL default 0, - tab int NOT NULL default 0, - title varchar(255) NOT NULL default '', - title_callback varchar(255) NOT NULL default '', - title_arguments varchar(255) NOT NULL default '', - parent varchar(255) NOT NULL default '', - type int NOT NULL default 0, - block_callback varchar(255) NOT NULL default '', - description varchar(255) NOT NULL default '', - position varchar(255) NOT NULL default '', - link_path varchar(255) NOT NULL default '', - attributes varchar(255) NOT NULL default '', - query varchar(255) NOT NULL default '', - fragment varchar(255) NOT NULL default '', - absolute INT NOT NULL default 0, - html INT NOT NULL default 0, - PRIMARY KEY (path) - )"); - - db_query("CREATE INDEX {menu}_fit_idx ON {menu} (fit)"); - db_query("CREATE INDEX {menu}_visible_idx ON {menu} (visible)"); - db_query("CREATE INDEX {menu}_parent_idx ON {menu} (parent)"); - db_query("CREATE INDEX {menu}_pid_idx ON {menu} (parent)"); - - db_query("CREATE TABLE {node} ( - nid serial CHECK (nid >= 0), - vid int_unsigned NOT NULL default '0', - type varchar(32) NOT NULL default '', - language varchar(12) NOT NULL default '', - title varchar(128) NOT NULL default '', - uid int NOT NULL default '0', - status int NOT NULL default '1', - created int NOT NULL default '0', - changed int NOT NULL default '0', - comment int NOT NULL default '0', - promote int NOT NULL default '0', - moderate int NOT NULL default '0', - sticky int NOT NULL default '0', - PRIMARY KEY (nid, vid), - UNIQUE (vid) - )"); - db_query("CREATE INDEX {node}_node_type_idx ON {node} (substr (type, 1, 4))"); - db_query("CREATE INDEX {node}_node_title_type_idx ON {node} (title, substr(type, 1, 4))"); - db_query("CREATE INDEX {node}_status_idx ON {node} (status)"); - db_query("CREATE INDEX {node}_uid_idx ON {node} (uid)"); - db_query("CREATE INDEX {node}_node_moderate_idx ON {node} (moderate)"); - db_query("CREATE INDEX {node}_node_promote_status_idx ON {node} (promote, status)"); - db_query("CREATE INDEX {node}_node_created_idx ON {node} (created)"); - db_query("CREATE INDEX {node}_node_changed_idx ON {node} (changed)"); - db_query("CREATE INDEX {node}_node_status_type_idx ON {node} (status, type, nid)"); - db_query("CREATE INDEX {node}_nid_idx ON {node} (nid)"); - - db_query("CREATE TABLE {node_access} ( - nid int_unsigned NOT NULL default '0', - gid int_unsigned NOT NULL default '0', - realm varchar(255) NOT NULL default '', - grant_view smallint_unsigned NOT NULL default '0', - grant_update smallint_unsigned NOT NULL default '0', - grant_delete smallint_unsigned NOT NULL default '0', - PRIMARY KEY (nid,gid,realm) - )"); - - db_query("CREATE TABLE {node_revisions} ( - nid int_unsigned NOT NULL, - vid serial CHECK (vid >= 0), - uid int NOT NULL default '0', - title varchar(128) NOT NULL default '', - body text NOT NULL default '', - teaser text NOT NULL default '', - log text NOT NULL default '', - timestamp int NOT NULL default '0', - format int NOT NULL default '0', - PRIMARY KEY (vid) - )"); - db_query("CREATE INDEX {node_revisions}_nid_idx ON {node_revisions} (nid)"); - db_query("CREATE INDEX {node_revisions}_uid_idx ON {node_revisions} (uid)"); - - db_query("CREATE TABLE {node_type} ( - type varchar(32) NOT NULL, - name varchar(255) NOT NULL default '', - module varchar(255) NOT NULL, - description text NOT NULL, - help text NOT NULL, - has_title smallint_unsigned NOT NULL, - title_label varchar(255) NOT NULL default '', - has_body smallint_unsigned NOT NULL, - body_label varchar(255) NOT NULL default '', - min_word_count smallint_unsigned NOT NULL, - custom smallint NOT NULL DEFAULT '0', - modified smallint NOT NULL DEFAULT '0', - locked smallint NOT NULL DEFAULT '0', - orig_type varchar(255) NOT NULL default '', - PRIMARY KEY (type) - )"); - - db_query("CREATE TABLE {url_alias} ( - pid serial CHECK (pid >= 0), - src varchar(128) NOT NULL default '', - dst varchar(128) NOT NULL default '', - language varchar(12) NOT NULL default '', - PRIMARY KEY (pid) - )"); - db_query("CREATE INDEX {url_alias}_src_idx ON {url_alias} (src)"); - db_query("CREATE UNIQUE INDEX {url_alias}_dst_language_idx ON {url_alias} (dst, language)"); - - db_query("CREATE TABLE {permission} ( - rid int_unsigned NOT NULL default '0', - perm text, - tid int_unsigned NOT NULL default '0' - )"); - db_query("CREATE INDEX {permission}_rid_idx ON {permission} (rid)"); - - db_query("CREATE TABLE {role} ( - rid serial CHECK (rid >= 0), - name varchar(64) NOT NULL default '', - PRIMARY KEY (rid), - UNIQUE (name) - )"); - - db_query("CREATE TABLE {blocks_roles} ( - module varchar(64) NOT NULL, - delta varchar(32) NOT NULL, - rid int_unsigned NOT NULL, - PRIMARY KEY (module, delta, rid) - )"); - - db_query("CREATE TABLE {sessions} ( - uid int_unsigned NOT NULL, - sid varchar(64) NOT NULL default '', - hostname varchar(128) NOT NULL default '', - timestamp int NOT NULL default '0', - cache int NOT NULL default '0', - session text, - PRIMARY KEY (sid) - )"); - db_query("CREATE INDEX {sessions}_uid_idx ON {sessions} (uid)"); - db_query("CREATE INDEX {sessions}_timestamp_idx ON {sessions} (timestamp)"); - -/* Only used for MySQL - db_query("CREATE TABLE {sequences} ( - name varchar(255) NOT NULL default '', - id int_unsigned NOT NULL default '0', - PRIMARY KEY (name) - )"); */ - - db_query("CREATE TABLE {node_counter} ( - nid int NOT NULL default '0', - totalcount bigint_unsigned NOT NULL default '0', - daycount int_unsigned NOT NULL default '0', - timestamp int_unsigned NOT NULL default '0', - PRIMARY KEY (nid) - )"); - - db_query("CREATE TABLE {system} ( - filename varchar(255) NOT NULL default '', - name varchar(255) NOT NULL default '', - type varchar(255) NOT NULL default '', - owner varchar(255) NOT NULL default '', - status int NOT NULL default '0', - throttle smallint DEFAULT '0' NOT NULL, - bootstrap int NOT NULL default '0', - schema_version smallint NOT NULL default -1, - weight int NOT NULL default '0', - info text, - PRIMARY KEY (filename) - )"); - db_query("CREATE INDEX {system}_weight_idx ON {system} (weight)"); - - db_query("CREATE TABLE {term_data} ( - tid serial CHECK (tid >= 0), - vid int_unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '', - description text, - weight smallint NOT NULL default '0', - PRIMARY KEY (tid) - )"); - db_query("CREATE INDEX {term_data}_vid_idx ON {term_data} (vid)"); - - db_query("CREATE TABLE {term_hierarchy} ( - tid int_unsigned NOT NULL default '0', - parent int_unsigned NOT NULL default '0', - PRIMARY KEY (tid, parent) - )"); - db_query("CREATE INDEX {term_hierarchy}_tid_idx ON {term_hierarchy} (tid)"); - db_query("CREATE INDEX {term_hierarchy}_parent_idx ON {term_hierarchy} (parent)"); - - db_query("CREATE TABLE {term_node} ( - nid int_unsigned NOT NULL default '0', - vid int_unsigned NOT NULL default '0', - tid int_unsigned NOT NULL default '0', - PRIMARY KEY (tid,nid,vid) - )"); - db_query("CREATE INDEX {term_node}_nid_idx ON {term_node} (nid)"); - db_query("CREATE INDEX {term_node}_vid_idx ON {term_node} (vid)"); - db_query("CREATE INDEX {term_node}_tid_idx ON {term_node} (tid)"); - - db_query("CREATE TABLE {term_relation} ( - tid1 int_unsigned NOT NULL default '0', - tid2 int_unsigned NOT NULL default '0' - )"); - db_query("CREATE INDEX {term_relation}_tid1_idx ON {term_relation} (tid1)"); - db_query("CREATE INDEX {term_relation}_tid2_idx ON {term_relation} (tid2)"); - - db_query("CREATE TABLE {term_synonym} ( - tid int_unsigned NOT NULL default '0', - name varchar(255) NOT NULL default '' - )"); - db_query("CREATE INDEX {term_synonym}_tid_idx ON {term_synonym} (tid)"); - db_query("CREATE INDEX {term_synonym}_name_idx ON {term_synonym} (substr(name, 1, 3))"); - - db_query("CREATE TABLE {users} ( - uid serial CHECK (uid >= 0), - name varchar(60) NOT NULL default '', - pass varchar(32) NOT NULL default '', - mail varchar(64) default '', - mode smallint NOT NULL default '0', - sort smallint default '0', - threshold smallint default '0', - theme varchar(255) NOT NULL default '', - signature varchar(255) NOT NULL default '', - created int NOT NULL default '0', - access int NOT NULL default '0', - login int NOT NULL default '0', - status smallint NOT NULL default '0', - timezone varchar(8) default NULL, - language varchar(12) NOT NULL default '', - picture varchar(255) NOT NULL DEFAULT '', - init varchar(64) default '', - data text, - PRIMARY KEY (uid), - UNIQUE (name) - )"); - db_query("CREATE INDEX {users}_access_idx ON {users} (access)"); - db_query("CREATE INDEX {users}_created_idx ON {users} (created)"); - - db_query("CREATE TABLE {users_roles} ( - uid int_unsigned NOT NULL default '0', - rid int_unsigned NOT NULL default '0', - PRIMARY KEY (uid, rid) - )"); - - db_query("CREATE TABLE {variable} ( - name varchar(128) NOT NULL default '', - value text NOT NULL, - language varchar(12) NOT NULL default '', - PRIMARY KEY (name, language) - )"); - - db_query("CREATE TABLE {vocabulary} ( - vid serial CHECK (vid >= 0), - name varchar(255) NOT NULL default '', - description text, - help varchar(255) NOT NULL default '', - relations smallint_unsigned NOT NULL default '0', - hierarchy smallint_unsigned NOT NULL default '0', - multiple smallint_unsigned NOT NULL default '0', - required smallint_unsigned NOT NULL default '0', - tags smallint_unsigned NOT NULL default '0', - module varchar(255) NOT NULL default '', - weight smallint NOT NULL default '0', - PRIMARY KEY (vid) - )"); - - db_query("CREATE TABLE {vocabulary_node_types} ( - vid int_unsigned NOT NULL DEFAULT '0', - type varchar(32) NOT NULL DEFAULT '', - PRIMARY KEY (vid, type) - )"); - - break; + + // Tables that shall be created + $tables = array( + 'access', 'authmap', 'blocks', 'boxes', 'cache', 'cache_filter', 'cache_page', + 'comments', 'node_comment_statistics', 'files', 'file_revisions', + 'filter_formats', 'filters', 'flood', 'history', 'menu', 'node', + 'node_access', 'node_revisions', 'node_type', 'url_alias', 'permission', + 'role', 'blocks_roles', 'sessions', 'sequences', 'node_counter', 'system', + 'term_data', 'term_hierarchy', 'term_node', 'term_relation', 'term_synonym', + 'users', 'users_roles', 'variable', 'vocabulary', 'vocabulary_node_types' + ); + + // Create tables. + foreach ($tables as $table) { + $schema = drupal_get_schema($table); + db_create_table($schema); } db_query("INSERT INTO {system} (filename, name, type, owner, status, throttle, bootstrap, schema_version) VALUES ('themes/engines/phptemplate/phptemplate.engine', 'phptemplate', 'theme_engine', '', 1, 0, 0, 0)"); Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.472 diff -u -F^f -r1.472 system.module --- modules/system/system.module 30 Apr 2007 17:03:28 -0000 1.472 +++ modules/system/system.module 1 May 2007 01:13:39 -0000 @@ -2461,3 +2461,24 @@ function system_cron() { db_query('DELETE FROM {flood} WHERE timestamp < %d', time() - 3600); } + + +function system_tables() { + $tables = array( + 'authmap' => 'authmap', + 'cache' => 'cache', + 'cache_filter' => 'cache', + 'cache_page' => 'cache', + 'files' => 'files', + 'file_revisions' => 'file_revisions', + 'flood' => 'flood', + 'history' => 'history', + 'menu' => 'menu', + 'sequences' => 'sequences', + 'sessions' => 'sessions', + 'system' => 'system', + 'url_alias' => 'url_alias', + 'variable' => 'variable', + ); + return $tables; +} Index: modules/system/system.schemas =================================================================== RCS file: modules/system/system.schemas diff -N modules/system/system.schemas --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/system/system.schemas 1 May 2007 01:13:39 -0000 @@ -0,0 +1,231 @@ + array('type' => 'int', 'unsigned' => true, 'default' => false, 'auto_increment' => true), + 'uid' => array('type' => 'int'), + 'authname' => array('type' => 'varchar', 'length' => 128), + 'module' => array('type' => 'varchar', 'length' => 128) + ); + + $schema['unique keys'] = array('authname' => array('authname')); + $schema['primary key'] = array('aid'); + + return $schema; +} + +function schema_cache() { + $schema['name'] = 'cache'; + $schema['fields'] = array( + 'cid' => array('type' => 'varchar'), + 'data' => array('type' => 'blob', 'not null' => false, 'size' => 'big'), + 'expire' => array('type' => 'int'), + 'created' => array('type' => 'int'), + 'headers' => array('type' => 'text', 'not null' => false), + 'serialized' => array('type' => 'int') + ); + + $schema['indexes'] = array('expire' => array('expire')); + $schema['primary key'] = array('cid'); + + return $schema; +} + +function schema_files() { + $schema['name'] = 'files'; + $schema['fields'] = array( + 'fid' => array('type' => 'int', 'unsigned' => true), + 'nid' => array('type' => 'int', 'unsigned' => true), + 'filename' => array('type' => 'varchar'), + 'filepath' => array('type' => 'varchar'), + 'filemime' => array('type' => 'varchar'), + 'filesize' => array('type' => 'int', 'unsigned' => true) + ); + + $schema['indexes'] = array('nid' => array('nid')); + $schema['primary key'] = array('fid'); + + return $schema; +} + +function schema_file_revisions() { + $schema['name'] = 'file_revisions'; + $schema['fields'] = array( + 'fid' => array('type' => 'int', 'unsigned' => true), + 'vid' => array('type' => 'int', 'unsigned' => true), + 'description' => array('type' => 'varchar'), + 'list' => array('type' => 'int', 'unsigned' => true, 'size' => 'tiny') + ); + + $schema['primary key'] = array( + 'fid', + 'vid' + ); + $schema['indexes'] = array('vid' => array('vid')); + + return $schema; +} + +function schema_flood() { + $schema['name'] = 'flood'; + $schema['fields'] = array( + 'event' => array('type' => 'varchar', 'length' => 64), + 'hostname' => array('type' => 'varchar', 'length' => 128), + 'timestamp' => array('type' => 'int') + ); + + + return $schema; +} + +function schema_history() { + $schema['name'] = 'history'; + $schema['fields'] = array( + 'uid' => array('type' => 'int'), + 'nid' => array('type' => 'int'), + 'timestamp' => array('type' => 'int') + ); + + $schema['primary key'] = array( + 'uid', + 'nid' + ); + + return $schema; +} + +function schema_menu() { + $schema['name'] = 'menu'; + $schema['fields'] = array( + 'mid' => array('type' => 'int'), + 'pid' => array('type' => 'int'), + 'path' => array('type' => 'varchar'), + 'load_functions' => array('type' => 'varchar'), + 'to_arg_functions' => array('type' => 'varchar'), + 'access_callback' => array('type' => 'varchar'), + 'access_arguments' => array('type' => 'text', 'not null' => false), + 'page_callback' => array('type' => 'varchar'), + 'page_arguments' => array('type' => 'text', 'not null' => false), + 'fit' => array('type' => 'int'), + 'number_parts' => array('type' => 'int'), + 'mleft' => array('type' => 'int'), + 'mright' => array('type' => 'int'), + 'visible' => array('type' => 'int'), + 'parents' => array('type' => 'varchar'), + 'depth' => array('type' => 'int'), + 'has_children' => array('type' => 'int'), + 'tab' => array('type' => 'int'), + 'title' => array('type' => 'varchar'), + 'title_callback' => array('type' => 'varchar'), + 'title_arguments' => array('type' => 'varchar'), + 'parent' => array('type' => 'varchar'), + 'type' => array('type' => 'int'), + 'block_callback' => array('type' => 'varchar'), + 'description' => array('type' => 'varchar'), + 'position' => array('type' => 'varchar'), + 'link_path' => array('type' => 'varchar'), + 'attributes' => array('type' => 'varchar'), + 'query' => array('type' => 'varchar'), + 'fragment' => array('type' => 'varchar'), + 'absolute' => array('type' => 'int'), + 'html' => array('type' => 'int') + ); + + $schema['indexes'] = array( + 'fit' => array('fit'), + 'parent' => array('parent'), + 'pid' => array('pid'), + 'visible' => array('visible') + ); + $schema['primary key'] = array('path'); + + return $schema; +} + +function schema_sequences() { + $schema['name'] = 'sequences'; + $schema['fields'] = array( + 'name' => array('type' => 'varchar'), + 'id' => array('type' => 'int', 'unsigned' => true) + ); + + $schema['primary key'] = array('name'); + + return $schema; +} + +function schema_sessions() { + $schema['name'] = 'sessions'; + $schema['fields'] = array( + 'uid' => array('type' => 'int', 'unsigned' => true, 'default' => false), + 'sid' => array('type' => 'varchar', 'length' => 64), + 'hostname' => array('type' => 'varchar', 'length' => 128), + 'timestamp' => array('type' => 'int'), + 'cache' => array('type' => 'int'), + 'session' => array('type' => 'text', 'not null' => false, 'size' => 'big') + ); + + $schema['primary key'] = array('sid'); + $schema['indexes'] = array( + 'timestamp' => array('timestamp'), + 'uid' => array('uid') + ); + + return $schema; +} + +function schema_system() { + $schema['name'] = 'system'; + $schema['fields'] = array( + 'filename' => array('type' => 'varchar'), + 'name' => array('type' => 'varchar'), + 'type' => array('type' => 'varchar'), + 'owner' => array('type' => 'varchar'), + 'status' => array('type' => 'int'), + 'throttle' => array('type' => 'int', 'size' => 'tiny'), + 'bootstrap' => array('type' => 'int'), + 'schema_version' => array('type' => 'int', 'default' => -1, 'size' => 'small'), + 'weight' => array('type' => 'int'), + 'info' => array('type' => 'text', 'not null' => false) + ); + + $schema['primary key'] = array('filename'); + $schema['indexes'] = array('weight' => array('weight')); + + return $schema; +} + +function schema_url_alias() { + $schema['name'] = 'url_alias'; + $schema['fields'] = array( + 'pid' => array('type' => 'int', 'unsigned' => true, 'default' => false, 'auto_increment' => true), + 'src' => array('type' => 'varchar', 'length' => 128), + 'dst' => array('type' => 'varchar', 'length' => 128), + 'language' => array('type' => 'varchar', 'length' => 12) + ); + + $schema['unique keys'] = array('dst_language' => array('dst', 'language')); + $schema['primary key'] = array('pid'); + $schema['indexes'] = array('src' => array('src')); + + return $schema; +} + +function schema_variable() { + $schema['name'] = 'variable'; + $schema['fields'] = array( + 'name' => array('type' => 'varchar', 'length' => 128), + 'value' => array('type' => 'text', 'default' => false, 'size' => 'big'), + 'language' => array('type' => 'varchar', 'length' => 12) + ); + + $schema['primary key'] = array( + 'name', + 'language' + ); + + return $schema; +} + Index: modules/taxonomy/taxonomy.module =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v retrieving revision 1.353 diff -u -F^f -r1.353 taxonomy.module --- modules/taxonomy/taxonomy.module 30 Apr 2007 17:03:28 -0000 1.353 +++ modules/taxonomy/taxonomy.module 1 May 2007 01:13:40 -0000 @@ -1559,3 +1559,17 @@ function taxonomy_implode_tags($tags, $v } return implode(', ', $typed_tags); } + + +function taxonomy_tables() { + $tables = array( + 'term_data' => 'term_data', + 'term_hierarchy' => 'term_hierarchy', + 'term_node' => 'term_node', + 'term_relation' => 'term_relation', + 'term_synonym' => 'term_synonym', + 'vocabulary' => 'vocabulary', + 'vocabulary_node_types' => 'vocabulary_node_types', + ); + return $tables; +} Index: modules/taxonomy/taxonomy.schemas =================================================================== RCS file: modules/taxonomy/taxonomy.schemas diff -N modules/taxonomy/taxonomy.schemas --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/taxonomy/taxonomy.schemas 1 May 2007 01:13:40 -0000 @@ -0,0 +1,126 @@ + array('type' => 'int', 'unsigned' => true, 'default' => false, 'auto_increment' => true), + 'vid' => array('type' => 'int', 'unsigned' => true), + 'name' => array('type' => 'varchar'), + 'description' => array('type' => 'text', 'not null' => false, 'size' => 'big'), + 'weight' => array('type' => 'int', 'size' => 'tiny') + ); + + $schema['primary key'] = array('tid'); + $schema['indexes'] = array('vid' => array('vid')); + + return $schema; +} + +function schema_term_hierarchy() { + $schema['name'] = 'term_hierarchy'; + $schema['fields'] = array( + 'tid' => array('type' => 'int', 'unsigned' => true), + 'parent' => array('type' => 'int', 'unsigned' => true) + ); + + $schema['indexes'] = array( + 'parent' => array('parent'), + 'tid' => array('tid') + ); + $schema['primary key'] = array( + 'tid', + 'parent' + ); + + return $schema; +} + +function schema_term_node() { + $schema['name'] = 'term_node'; + $schema['fields'] = array( + 'nid' => array('type' => 'int', 'unsigned' => true), + 'vid' => array('type' => 'int', 'unsigned' => true), + 'tid' => array('type' => 'int', 'unsigned' => true) + ); + + $schema['indexes'] = array( + 'nid' => array('nid'), + 'tid' => array('tid'), + 'vid' => array('vid') + ); + $schema['primary key'] = array( + 'vid', + 'tid', + 'nid' + ); + + return $schema; +} + +function schema_term_relation() { + $schema['name'] = 'term_relation'; + $schema['fields'] = array( + 'tid1' => array('type' => 'int', 'unsigned' => true), + 'tid2' => array('type' => 'int', 'unsigned' => true) + ); + + $schema['indexes'] = array( + 'tid1' => array('tid1'), + 'tid2' => array('tid2') + ); + + return $schema; +} + +function schema_term_synonym() { + $schema['name'] = 'term_synonym'; + $schema['fields'] = array( + 'tid' => array('type' => 'int', 'unsigned' => true), + 'name' => array('type' => 'varchar') + ); + + $schema['indexes'] = array( + 'name' => array('name'), + 'tid' => array('tid') + ); + + return $schema; +} + +function schema_vocabulary() { + $schema['name'] = 'vocabulary'; + $schema['fields'] = array( + 'vid' => array('type' => 'int', 'unsigned' => true, 'default' => false, 'auto_increment' => true), + 'name' => array('type' => 'varchar'), + 'description' => array('type' => 'text', 'not null' => false, 'size' => 'big'), + 'help' => array('type' => 'varchar'), + 'relations' => array('type' => 'int', 'unsigned' => true, 'size' => 'tiny'), + 'hierarchy' => array('type' => 'int', 'unsigned' => true, 'size' => 'tiny'), + 'multiple' => array('type' => 'int', 'unsigned' => true, 'size' => 'tiny'), + 'required' => array('type' => 'int', 'unsigned' => true, 'size' => 'tiny'), + 'tags' => array('type' => 'int', 'unsigned' => true, 'size' => 'tiny'), + 'module' => array('type' => 'varchar'), + 'weight' => array('type' => 'int', 'size' => 'tiny') + ); + + $schema['primary key'] = array('vid'); + + return $schema; +} + +function schema_vocabulary_node_types() { + $schema['name'] = 'vocabulary_node_types'; + $schema['fields'] = array( + 'vid' => array('type' => 'int', 'unsigned' => true), + 'type' => array('type' => 'varchar', 'length' => 32) + ); + + $schema['primary key'] = array( + 'vid', + 'type' + ); + + return $schema; +} + Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.777 diff -u -F^f -r1.777 user.module --- modules/user/user.module 30 Apr 2007 17:03:29 -0000 1.777 +++ modules/user/user.module 1 May 2007 01:13:41 -0000 @@ -2851,3 +2851,15 @@ function theme_user_signature($signature return $output; } + + +function user_tables() { + $tables = array( + 'access' => 'access', + 'permission' => 'permission', + 'role' => 'role', + 'users' => 'users', + 'users_roles' => 'users_roles', + ); + return $tables; +} Index: modules/user/user.schemas =================================================================== RCS file: modules/user/user.schemas diff -N modules/user/user.schemas --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/user/user.schemas 1 May 2007 01:13:41 -0000 @@ -0,0 +1,91 @@ + array('type' => 'int', 'default' => false, 'auto_increment' => true), + 'mask' => array('type' => 'varchar'), + 'type' => array('type' => 'varchar'), + 'status' => array('type' => 'int', 'size' => 'tiny') + ); + + $schema['primary key'] = array('aid'); + + return $schema; +} + +function schema_permission() { + $schema['name'] = 'permission'; + $schema['fields'] = array( + 'rid' => array('type' => 'int', 'unsigned' => true), + 'perm' => array('type' => 'text', 'not null' => false, 'size' => 'big'), + 'tid' => array('type' => 'int', 'unsigned' => true) + ); + + $schema['indexes'] = array('rid' => array('rid')); + + return $schema; +} + +function schema_role() { + $schema['name'] = 'role'; + $schema['fields'] = array( + 'rid' => array('type' => 'int', 'unsigned' => true, 'default' => false, 'auto_increment' => true), + 'name' => array('type' => 'varchar', 'length' => 64) + ); + + $schema['unique keys'] = array('name' => array('name')); + $schema['primary key'] = array('rid'); + + return $schema; +} + +function schema_users() { + $schema['name'] = 'users'; + $schema['fields'] = array( + 'uid' => array('type' => 'int', 'unsigned' => true), + 'name' => array('type' => 'varchar', 'length' => 60), + 'pass' => array('type' => 'varchar', 'length' => 32), + 'mail' => array('type' => 'varchar', 'length' => 64, 'not null' => false), + 'mode' => array('type' => 'int', 'size' => 'tiny'), + 'sort' => array('type' => 'int', 'not null' => false, 'size' => 'tiny'), + 'threshold' => array('type' => 'int', 'not null' => false, 'size' => 'tiny'), + 'theme' => array('type' => 'varchar'), + 'signature' => array('type' => 'varchar'), + 'created' => array('type' => 'int'), + 'access' => array('type' => 'int'), + 'login' => array('type' => 'int'), + 'status' => array('type' => 'int', 'size' => 'tiny'), + 'timezone' => array('type' => 'varchar', 'length' => 8, 'not null' => false), + 'language' => array('type' => 'varchar', 'length' => 12), + 'picture' => array('type' => 'varchar'), + 'init' => array('type' => 'varchar', 'length' => 64, 'not null' => false), + 'data' => array('type' => 'text', 'not null' => false, 'size' => 'big') + ); + + $schema['indexes'] = array( + 'access' => array('access'), + 'created' => array('created') + ); + $schema['unique keys'] = array('name' => array('name')); + $schema['primary key'] = array('uid'); + + return $schema; +} + +function schema_users_roles() { + $schema['name'] = 'users_roles'; + $schema['fields'] = array( + 'uid' => array('type' => 'int', 'unsigned' => true), + 'rid' => array('type' => 'int', 'unsigned' => true) + ); + + $schema['primary key'] = array( + 'uid', + 'rid' + ); + + return $schema; +} +