public void createOrMigrateSchema(String tableName,
String entitySchemaString, boolean createTableAndFamilies) {
String entityName = getEntityNameFromSchemaString(entitySchemaString);
AvroEntitySchema entitySchema = parser
.parseEntitySchema(entitySchemaString);
AvroKeySchema keySchema = parser.parseKeySchema(entitySchemaString);
if (schemaManager.hasManagedSchema(tableName, entityName)) {
KeySchema currentKeySchema = schemaManager.getKeySchema(tableName,
entityName);
if (!keySchema.equals(currentKeySchema)) {
String msg = "Migrating schema with different keys. Current: "
+ currentKeySchema.getRawSchema() + " New: "
+ keySchema.getRawSchema();
LOG.error(msg);
throw new SchemaValidationException(msg);
}
if (schemaManager.getEntityVersion(tableName, entityName, entitySchema) == -1) {
LOG.info("Migrating Schema: (" + tableName + ", " + entityName + ")");