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 ValidationException(msg);
}
if (!schemaManager.hasSchemaVersion(tableName, entityName, entitySchema)) {
LOG.info("Migrating Schema: (" + tableName + ", " + entityName + ")");