package com.txtr.hibernatedelta.generator; import java.io.File; import com.google.common.collect.ImmutableList; import com.txtr.hibernatedelta.DatabaseWithIndexes; import com.txtr.hibernatedelta.validator.EntityValidator; public class UpdateSqlGenerator { private UpdateSqlGenerator() { } public static void main(String[] args) throws Exception { // System.out.println(generateChanges(true)); } public static String generateChanges(boolean writeChanges, ImmutableList<Class<?>> entityClasses, File schema, File indexNames) throws Exception { DatabaseWithIndexes newDatabase = new EntityValidator().verify(entityClasses, indexNames.toURI().toURL()); final String sql = new BackendSqlGenerator().createUpdateAgainstCommittedSchema(schema.toURI().toURL(), newDatabase, indexNames.toURI().toURL()); if (writeChanges) { new BackendSqlGenerator().writeDataModelFiles( schema, indexNames, newDatabase); } return sql; } }