private void migrateTenantDefinition(String keyspace) {
        TenantDefinition tempTenantDef = new TenantDefinition();
        tempTenantDef.setName(keyspace);
        Tenant migratingTenant = new Tenant(tempTenantDef);
        DColumn col = DBService.instance(migratingTenant).getColumn("Applications", "_tenant", "Definition");
        if (col == null) {
            return;
        }
        m_logger.info("Migrating tenant definition from keyspace {}", keyspace);
        TenantDefinition migratingTenantDef = new TenantDefinition();
        try {
            migratingTenantDef.parse(UNode.parseJSON(col.getValue()));
        } catch (Exception e) {
            m_logger.warn("Couldn't parse tenant definition; skipping migration of keyspace: " + keyspace, e);
            return;
        }
        storeTenantDefinition(migratingTenantDef);
        DBTransaction dbTran = new DBTransaction(migratingTenant);
        dbTran.deleteRow("Applications", "_tenant");
        DBService.instance(migratingTenant).commit(dbTran);
    }
private void migrateTenantDefinition ( String keyspace ) { TenantDefinition tempTenantDef = new TenantDefinition ( ) ; tempTenantDef . setName ( keyspace ) ; Tenant migratingTenant = new Tenant ( tempTenantDef ) ; DColumn col = DBService . instance ( migratingTenant ) . getColumn ( "Applications" , "_tenant" , "Definition" ) ; if ( col == null ) { return ; } m_logger . info ( "Migrating tenant definition from keyspace {}" , keyspace ) ; TenantDefinition migratingTenantDef = new TenantDefinition ( ) ; try { migratingTenantDef . parse ( UNode . parseJSON ( col . getValue ( ) ) ) ; } catch ( Exception e ) { m_logger . warn ( "Couldn't parse tenant definition; skipping migration of keyspace: " + keyspace , e ) ; return ; } storeTenantDefinition ( migratingTenantDef ) ; DBTransaction dbTran = new DBTransaction ( migratingTenant ) ; dbTran . deleteRow ( "Applications" , "_tenant" ) ; DBService . instance ( migratingTenant ) . commit ( dbTran ) ; }
Migrate legacy "_tenant" row, if it exists to the Tenants table.