code: func (db *schemaUpdater) updateSchema6to7() {
  	t := db.newReadWriteTransaction()
  	defer t.close()
  
  	var gk []byte
  	var nk []byte
  
  	for _, folderStr := range db.ListFolders() {
  		folder := []byte(folderStr)
  		db.withNeedLocal(folder, false, func(f FileIntf) bool {
  			name := []byte(f.FileName())
  			global := f.(protocol.FileInfo)
  			gk = db.keyer.GenerateGlobalVersionKey(gk, folder, name)
  			svl, err := t.Get(gk, nil)
  			if err != nil {
  				// If there is no global list, we hardly need it.
  				t.Delete(t.keyer.GenerateNeedFileKey(nk, folder, name))
  				return true
  			}
  			var fl VersionList
  			err = fl.Unmarshal(svl)
  			if err != nil {
  				// This can't happen, but it's ignored everywhere else too,
  				// so lets not act on it.
  				return true
  			}
  			if localFV, haveLocalFV := fl.Get(protocol.LocalDeviceID[:]); !need(global, haveLocalFV, localFV.Version) {
  				t.Delete(t.keyer.GenerateNeedFileKey(nk, folder, name))
  			}
  			return true
  		})
  	}
  }
docs: // updateSchema6to7 checks whether all currently locally needed files are really
  // needed and removes them if not.