From ab2a1b4d9ee082475bcf883e556d916faa7389aa Mon Sep 17 00:00:00 2001
From: Adam <a.sanchez75@gmail.com>
Date: Tue, 10 Jul 2012 10:53:38 -0500
Subject: [PATCH] Issue #1678148 by asanchez75: Fixed use of db_change_field().

---
 data_search/data_search.info    |    2 +-
 data_search/data_search.install |   18 ++++++++++++++----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/data_search/data_search.info b/data_search/data_search.info
index 2b5a054..bb58b08 100644
--- a/data_search/data_search.info
+++ b/data_search/data_search.info
@@ -3,4 +3,4 @@ description = "Provides search and views search integration for Data tables."
 package = Data
 dependencies[] = data
 dependencies[] = search
-core = 6.x
+core = 7.x
diff --git a/data_search/data_search.install b/data_search/data_search.install
index 426ccaf..8fbdaf0 100644
--- a/data_search/data_search.install
+++ b/data_search/data_search.install
@@ -9,12 +9,22 @@
 /**
  * Implements hook_install().
  *
- * @todo: Should use db_change_field()
  * @todo: What happens if data_search and search are installed at the same time?
  */
 function data_search_install() {
   // Adjust length of type columns for data tables with names of a max length of 64.
-  db_query("ALTER TABLE {search_dataset} CHANGE COLUMN type type VARCHAR(64)");
-  db_query("ALTER TABLE {search_index} CHANGE COLUMN type type VARCHAR(64)");
-  db_query("ALTER TABLE {search_node_links} CHANGE COLUMN type type VARCHAR(64)");
+  db_drop_primary_key('search_dataset');
+  db_change_field('search_dataset', 'type', 'type',
+  array('type' => 'varchar', 'not null' => TRUE, 'length' => 64),
+  array('primary key' => array('sid', 'type')));
+
+  db_drop_primary_key('search_index');
+  db_change_field('search_index', 'type', 'type',
+  array('type' => 'varchar', 'not null' => TRUE, 'length' => 64),
+  array('primary key' => array('word', 'sid', 'type')));
+  
+  db_drop_primary_key('search_node_links');
+  db_change_field('search_node_links', 'type', 'type',
+  array('type' => 'varchar', 'not null' => TRUE, 'length' => 64),
+  array('primary key' => array('sid', 'type', 'nid')));
 }
-- 
1.7.2.5

