code: def _startup(self):
          
          typesToCheck = []
  
          for oid, module, typename, version in self.querySchemaSQL(_schema.ALL_TYPES):
              if self.debug:
                  print
                  print 'SCHEMA:', oid, module, typename, version
              if typename not in _typeNameToMostRecentClass:
                  try:
                      namedAny(module)
                  except ValueError as err:
                      raise ImportError('cannot find module ' + module, str(err))
              self.typenameAndVersionToID[typename, version] = oid
  
          # Can't call this until typenameAndVersionToID is populated, since this
          # depends on building a reverse map of that.
          persistedSchema = self._loadTypeSchema()
  
          # Now that we have persistedSchema, loop over everything again and
          # prepare old types.
          for (typename, version), typeID in self.typenameAndVersionToID.iteritems():
              cls = _typeNameToMostRecentClass.get(typename)
  
              if cls is not None:
                  if version != cls.schemaVersion:
                      typesToCheck.append(
                          self._prepareOldVersionOf(
                              typename, version, persistedSchema))
                  else:
                      typesToCheck.append(cls)
  
          for cls in typesToCheck:
              self._checkTypeSchemaConsistency(cls, persistedSchema)
  
          # Schema is consistent!  Now, if I forgot to create any indexes last
          # time I saw this table, do it now...
          extantIndexes = self._loadExistingIndexes()
          for cls in typesToCheck:
              self._createIndexesFor(cls, extantIndexes)
  
          self._upgradeManager.checkUpgradePaths()
docs: Called during __init__.  Check consistency of schema in database with
          classes in memory.  Load all Python modules for stored items, and load
          version information for upgrader service to run later.