diff --git a/pdfthumb.install b/pdfthumb.install
index dcd0a67..d4c5b76 100644
--- a/pdfthumb.install
+++ b/pdfthumb.install
@@ -70,7 +70,20 @@ function pdfthumb_schema() {
         'default' => 0,
       ),
     ),
+    'primary key' => array('fid'),
+    'unique key' => array('fid' => array('fid'))
   );
 
   return $schema;
 }
+
+function pdfthumb_update_7101() {
+  // select distinct * fid
+  // foreach:
+  //	select pdffid except the MAX()
+  //	foreach:
+  //		delete file + delete record
+
+  // then
+  db_add_unique_key('pdfthumb', 'fid', array('fid'));
+}
