Index: CHANGELOG.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/CHANGELOG.txt,v
retrieving revision 1.15
diff -u -p -r1.15 CHANGELOG.txt
--- CHANGELOG.txt	17 Jan 2009 01:00:05 -0000	1.15
+++ CHANGELOG.txt	17 Jan 2009 21:01:29 -0000
@@ -6,6 +6,7 @@ Image x.x-x.x, xxxx-xx-xx
 
 Image 6.x-1.x, xxxx-xx-xx
 -------------------------
+#288378 by smk-ka, mustafau, sun: Added primary key and index to image table.
 #70396 by bibo, sun: Fixed node image size links are not localized.
 #310693 by sun: Updated image_access() for 6.x.
 #351552 by hass, sun: Changed Image Gallery's form submit button to "Save".
Index: image.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/image.install,v
retrieving revision 1.17
diff -u -p -r1.17 image.install
--- image.install	13 Jan 2009 09:32:25 -0000	1.17
+++ image.install	17 Jan 2009 21:00:47 -0000
@@ -11,12 +11,14 @@ function image_schema() {
       'nid' => array(
         'description' => 'Primary Key: The {node}.nid of the image node.',
         'type' => 'int',
+        'unsigned' => TRUE,
         'not null' => TRUE,
         'default' => 0,
       ),
       'fid' => array(
         'description' => 'Index: The {files}.fid of the image file.',
         'type' => 'int',
+        'unsigned' => TRUE,
         'not null' => TRUE,
         'default' => 0,
       ),
@@ -28,6 +30,10 @@ function image_schema() {
         'default' => '',
       ),
     ),
+    'primary key' => array('nid', 'image_size'),
+    'indexes' => array(
+      'fid' => array('fid'),
+    ),
   );
   return $schema;
 }
@@ -269,3 +275,26 @@ function image_update_5201() {
   
   return array();
 }
+
+/**
+ * Add primary key and index on 'fid' to {image} table.
+ */
+function image_update_6100() {
+  $ret = array();
+  db_change_field($ret, 'image', 'nid', 'nid', array(
+    'type' => 'int',
+    'unsigned' => TRUE,
+    'not null' => TRUE,
+    'default' => 0,
+  ));
+  db_change_field($ret, 'image', 'fid', 'fid', array(
+    'type' => 'int',
+    'unsigned' => TRUE,
+    'not null' => TRUE,
+    'default' => 0,
+  ));
+  db_add_primary_key($ret, 'image', array('nid', 'image_size'));
+  db_add_index($ret, 'image', 'fid', array('fid'));
+  return $ret;
+}
+
