Index: country_code.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/country_code/country_code.install,v
retrieving revision 1.16
diff -u -p -r1.16 country_code.install
--- country_code.install	28 Oct 2008 22:23:48 -0000	1.16
+++ country_code.install	3 Nov 2008 19:20:41 -0000
@@ -14,6 +14,10 @@ define('COUNTRY_CODE_MINIMUM_PHP', '5.1.
 function country_code_install() {
   // Create tables.
   drupal_install_schema('country_code');
+  // Add indexes required by views filters.
+  $return = array();
+  db_add_index($return, 'node', 'tnid_language', array('tnid', 'language'));
+  db_add_index($return, 'node', 'language', array('language'));
   // Set module weight higher than that of i18n module, which contains a conflicting
   // hook_translation_link_alter() implementation.
   $weight = db_result(db_query("SELECT weight FROM {system} WHERE name = 'i18n'"));
@@ -48,6 +52,16 @@ function country_code_schema() {
   return $schema;
 }
 
+/**
+ * Implementation of hook_schema_alter().
+ *
+ * Add indexes required by views filter.
+ */
+function country_code_schema_alter(&$schema) {
+  $schema['node']['indexes']['tnid_language'] = array('tnid', 'language');
+  $schema['node']['indexes']['language'] = array('language');
+}
+
 function country_code_update_1() {
   $return = array();
 
@@ -64,6 +78,14 @@ function country_code_update_2() {
   $return[] = update_sql("UPDATE {system} SET weight = " . ($weight ? $weight + 5 : 15) . " WHERE name = 'country_code' AND type = 'module'");
   return $return;
 }
+
+function country_code_update_3() {
+  $return = array();
+  db_add_index($return, 'node', 'tnid_language', array('tnid', 'language'));
+  db_add_index($return, 'node', 'language', array('language'));
+  return $return;
+}
+
 /**
  * Implementation of hook_uninstall().
  */
