@Override
  public void upgrade() {
    LOG.info("Updating metadata from version 6 to 7");
    List<String> sqls =
        Arrays.asList(
            "ALTER TABLE attributes ADD COLUMN visibleExpression TEXT",
            "ALTER TABLE attributes ADD COLUMN validationExpression TEXT");

    sqls.forEach(
        sql -> {
          try {
            LOG.info(sql);
            jdbcTemplate.execute(sql);
          } catch (DataAccessException e) {
            LOG.error(e.getMessage());
          }
        });
    LOG.info("Create bare mysql repository collection for the metadata...");

    DataServiceImpl dataService = new DataServiceImpl();

    // Get the undecorated repos
    MysqlRepositoryCollection undecoratedMySQL =
        new MysqlRepositoryCollection() {
          @Override
          protected MysqlRepository createMysqlRepository() {
            return new MysqlRepository(
                dataService, dataSource, new AsyncJdbcTemplate(new JdbcTemplate(dataSource)));
          }

          @Override
          public boolean hasRepository(String name) {
            throw new UnsupportedOperationException();
          }
        };
    MetaDataService metaData = new MetaDataServiceImpl(dataService);
    RunAsSystemProxy.runAsSystem(() -> metaData.setDefaultBackend(undecoratedMySQL));

    searchService.delete(AttributeMetaDataMetaData.ENTITY_NAME);
    searchService.createMappings(AttributeMetaDataMetaData.INSTANCE);

    searchService.rebuildIndex(
        undecoratedMySQL.getRepository(AttributeMetaDataMetaData.ENTITY_NAME),
        AttributeMetaDataMetaData.INSTANCE);
  }
 private String getSetting(String name, String defaultValue) {
   String value = RunAsSystemProxy.runAsSystem(() -> molgenisSettings.getString(name));
   return value != null ? value : defaultValue;
 }