         lastaccess not null default CURRENT_TIMESTAMP,
         primary key (itemid, context))
       ")
-    Zotero.DB.query('insert into betterbibtex.cache (itemID, context, citekey, entry) select itemID, context, citekey, entry from betterbibtex._cache_')
-    Zotero.DB.query('drop table betterbibtex._cache_')
-
-  Zotero.DB.query("insert or replace into betterbibtex._version_ (tablename, version) values ('keys', 10)")
+    unless columns.lastaccess
+      Zotero.DB.query('insert into betterbibtex.cache (itemID, context, citekey, entry) select itemID, context, citekey, entry from betterbibtex._cache_')
+      Zotero.DB.query('drop table betterbibtex._cache_')
+
+  ### upgrade 'autoexport' table ###
+  Zotero.DB.query("
+    create table if not exists betterbibtex.autoexport (
+      id integer primary key not null,
+      collection_id not null,
+      collection_name not null,
+      path not null,
+      context not null,
+      recursive not null,
+      status not null,
+      unique (collection_id, path, context))
+    ")
+
+  ### schema 3 & 7 had a scanning flaw, force rescan ###
+  if version < 7
+    @pref.set('scan-citekeys', true)
+
+  ### mark current version ###
+  Zotero.DB.query("insert or replace into betterbibtex.schema (lock, version) values ('schema', 11)")
 
   Zotero.Translate.Export::Sandbox.BetterBibTeX = {
     __exposedProps__: {keymanager: 'r', cache: 'r'}


      continue if extra.translator != 'BibTeX AUX Scanner'
      Zotero.BetterBibTeX.log('::: AUX', collection.id, extra.citations)

      missing = []
      for citekey in extra.citations

          collection.addItem(id)
        else
          Zotero.BetterBibTeX.log("::: citekey #{citekey} missing")
          missing.push(citekey)

      if missing.length == 0
        Zotero.BetterBibTeX.log("::: all citekeys found")
      else
        report = new Zotero.BetterBibTeX.HTMLNode('http://www.w3.org/1999/xhtml', 'html')
        report.div(->
          @p(-> @b('BibTeX AUX scan'))
          @p('Missing references:')
          @ul(->
            for citekey in missing
              @li(citekey)
            return
          )
          return
        )
        item = new Zotero.Item('note')
        item.libraryID = collection.libraryID
        item.setNote(report.serialize())
        item.save()
        collection.addItem(item.id)

    unless collections.length == 0 || Zotero.BetterBibTeX.pref.get('auto-export') == 'disabled'
      Zotero.DB.query("update betterbibtex.autoexport set status = 'pending' where collection_id in #{Zotero.BetterBibTeX.SQLSet(collections)}")
