Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
themekey_ui.install does not contain equivalent logic for creating the `themekey_ui_node_theme` table - yet references it:
db_create_table('themekey_ui_author_theme', $schema['themekey_ui_author_theme']);
// hook_update_N() no longer returns a $ret array. Instead, return
// nothing or a translated string indicating the update ran successfully.
// See http://drupal.org/node/224333#update_sql.
return t('Created table themekey_ui_author_theme') /* $ret */;
}
else {
return '';
}
}
...here's the reference:
function themekey_ui_schema() {
$schema = array();
$schema['themekey_ui_node_theme'] = array(
'fields' => array(
'nid' => array(
'description' => 'The {node} this version belongs to.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'vid' => array(
'description' => 'The primary identifier for this version.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'theme' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
),
'primary key' => array('nid', 'vid'),
);
$schema['themekey_ui_author_theme'] = array(
'fields' => array(
'uid' => array(
'description' => 'The user id.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'theme' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
),
'primary key' => array('uid'),
);
return $schema;
}
This causes a major problem when attempting to delete content:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table '<redacted>.themekey_ui_node_theme' doesn't exist: DELETE FROM {themekey_ui_node_theme}
WHERE (nid = :db_condition_placeholder_0) ; Array
(
[:db_condition_placeholder_0] => 7381
)
in themekey_ui_node_delete() (line 387 of /<redacted>/docroot/sites/all/modules/themekey/themekey_ui.module).
Nov 4 21:32:02<redacted>: http://<redacted>|1415136722|php|107.0.255.129|http://<redacted>/node/7381/delete?destination=admin/content|http://<redacted>/node/7381/delete?destination=admin/content|1||PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table '<redacted>.themekey_ui_node_theme' doesn't exist: DELETE FROM {themekey_ui_node_theme}
WHERE (nid = :db_condition_placeholder_0) ; Array
(
[:db_condition_placeholder_0] => 7381
)
in themekey_ui_node_delete() (line 387 of <redacted>/docroot/sites/all/modules/themekey/themekey_ui.module).
Comments
Comment #1
mkalkbrennerNo, the code is correct. While table themekey_ui_node_theme existed since the module existed, themekey_ui_author_theme has been added by update 6200.
Something else must have happened in your environment, like an error during the installation of the module.
Disable and uninstall themekey_ui and reinstall it to create the tables.
Comment #2
mkalkbrenner