class_docstr: Legacy protocol, store all experiments and trials inside the Database()
  
  Parameters
  ----------
  config: Dict
      configuration definition passed from experiment_builder
      to storage factory to legacy constructor.
      See `~orion.io.database.Database` for more details
  setup: bool
      Setup the database (create indexes)
class_docstr_tok: ["Legacy","protocol",",","store","all","experiments","and","trials","inside","the","Database","(",")","Parameters","--","--","--","--","--","config",":","Dict","configuration","definition","passed","from","experiment_builder","to","storage","factory","to","legacy","constructor",".","See","`","~orion.io.database.Database","`","for","more","details","setup",":","bool","Setup","the","database","(","create","indexes",")"]
docstr: Database index setup
docstr_tok: ["Database","index","setup"]
code: def _setup_db(self):
      """Database index setup"""
      if backward.db_is_outdated(self._db):
          raise OutdatedDatabaseError(
              "The database is outdated. You can upgrade it with the "
              "command `orion db upgrade`."
          )
  
      # TODO: What is that used for?
      # self._db.index_information("experiment")
      self._db.ensure_index(
          "experiments",
          [
              ("name", Database.ASCENDING),
              ("version", Database.ASCENDING),
          ],
          unique=True,
      )
  
      self._db.ensure_index("experiments", "metadata.datetime")
  
      self._db.ensure_index("benchmarks", "name", unique=True)
  
      self._db.ensure_index(
          "trials",
          [
              ("experiment", Database.ASCENDING),
              ("id", Database.ASCENDING),
          ],
          unique=True,
      )
      self._db.ensure_index("trials", "experiment")
      self._db.ensure_index("trials", "status")
      self._db.ensure_index("trials", "results")
      self._db.ensure_index("trials", "start_time")
      self._db.ensure_index(
          "trials", [("end_time", Database.DESCENDING)]
      )
  
      self._db.ensure_index("algo", "experiment")
  
imports: import contextlib
  import datetime
  import logging
  import pickle
  import time
  import orion.core
  import orion.core.utils.backward
  from orion.core.io.database import Database, OutdatedDatabaseError, database_factory
  from orion.core.worker.trial import Trial, validate_status
  from orion.storage.base import BaseStorageProtocol, FailedUpdate, LockAcquisitionTimeout, LockedAlgorithmState, get_trial_uid_and_exp, get_uid
label_desc: Use image node_id 2 for calling the Legacy obj's underlying member method code with example usage: obj._setup_db() without return types