class LegacyKeyStoreUpgradeService extends ComponentSupport {

  public void upgradeSchema() throws Exception {
    log.debug("Updgrading schema for trust store");
    try (ODatabaseDocumentTx db = databaseInstance.get().connect()) {
      OSchema schema = db.getMetadata().getSchema();
      OClass type = schema.getClass(DB_CLASS);
      if (type == null) {
        type = schema.createClass(DB_CLASS);
        type.createProperty(P_NAME, OType.STRING).setMandatory(true).setNotNull(true);
        type.createProperty(P_BYTES, OType.BINARY).setMandatory(true).setNotNull(true);
        type.createIndex(I_NAME, INDEX_TYPE.UNIQUE, P_NAME);
        log.debug("Created schema type {}: properties={}, indexes={}", type, type.properties(), type.getIndexes());
      }
      else {
        // NOTE: Upgrade steps run on each node but within a cluster, another node might already have upgraded the db
        log.debug("Skipped creating existing schema type {}: properties={}, indexes={}", type, type.properties(),
            type.getIndexes());
      }
    }
  }

  @Inject public  LegacyKeyStoreUpgradeService(@Named(DatabaseInstanceNames.CONFIG) final Provider<DatabaseInstance> databaseInstance,
                                      final ApplicationDirectories appDirectories);

}