return evolutions;
}
public synchronized static Stack<Evolution> listDatabaseEvolutions(String moduleKey) {
Stack<Evolution> evolutions = new Stack<Evolution>();
evolutions.add(new Evolution("", 0, "", "", false));
Connection connection = null;
try {
connection = EvolutionQuery.getNewConnection();
String tableName = "play_evolutions";
boolean tableExists = true;
ResultSet rs = connection.getMetaData().getTables(null, null, tableName, null);
if (!rs.next()) {
// Table in lowercase does not exist
// oracle gives table names in upper case
tableName = tableName.toUpperCase();
Logger.trace("Checking " + tableName);
rs.close();
rs = connection.getMetaData().getTables(null, null, tableName, null);
// Does it exist?
if (!rs.next() ) {
// did not find it in uppercase either
tableExists = false;
}
}
// Do we have a
if (tableExists) {
checkAndUpdateEvolutionsForMultiModuleSupport(connection);
ResultSet databaseEvolutions = EvolutionQuery.getEvolutions(connection, moduleKey);
while (databaseEvolutions.next()) {
Evolution evolution = new Evolution(moduleKey, databaseEvolutions.getInt(1), databaseEvolutions.getString(3), databaseEvolutions.getString(4), false);
evolutions.add(evolution);
}
} else {
EvolutionQuery.createTable();