Skip to content

Commit

Permalink
Enable model migration using data source JNDI
Browse files Browse the repository at this point in the history
This patch adds the required verification in the canMigrateModel
method enabling migrations over data source JNDI when possible.
  • Loading branch information
hprange committed Feb 20, 2013
1 parent 0dc1414 commit b96cd1b
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,18 +318,21 @@ protected Map<IERXMigration, ERXModelVersion> _buildDependenciesForModelsNamed(N
}

protected boolean canMigrateModel(EOModel model) {
boolean canMigrateModel = false;
String adaptorName = model.adaptorName();
if ("Memory".equals(adaptorName)) {
canMigrateModel = true;
return true;
}
else if ("JDBC".equals(adaptorName)) {
if ("JDBC".equals(adaptorName)) {
String url = (String)model.connectionDictionary().objectForKey(JDBCAdaptor.URLKey);
if (url != null && url.toLowerCase().startsWith("jdbc:")) {
canMigrateModel = true;
if ((url != null && url.toLowerCase().startsWith("jdbc:"))) {
return true;
}
String dataSourceJndiName = (String) model.connectionDictionary().objectForKey(JDBCAdaptor.DataSourceJndiNameKey);
if(dataSourceJndiName != null) {
return true;
}
}
return canMigrateModel;
return false;
}

protected void _buildDependenciesForModel(EOModel model, int migrateToVersion, Map<String, Integer> versions, Map<IERXMigration, ERXModelVersion> migrations) throws InstantiationException, IllegalAccessException {
Expand Down

0 comments on commit b96cd1b

Please sign in to comment.