*
* @param migrationName
* @return SQL string
*/
protected String getSQLForMigration(String migrationName) {
NSBundle bundle;
String migrationBundleName = migrationBundleName();
if (migrationBundleName == null) {
bundle = NSBundle.bundleForClass(getClass());
}
else {
bundle = NSBundle.bundleForName(migrationBundleName());
if (bundle == null) {
bundle = NSBundle._appBundleForName(migrationBundleName());
}
}
NSArray<String> resourcePaths = bundle.resourcePathsForResources("migration", null);
if (resourcePaths != null) {
for (String currentPath : resourcePaths) {
if (currentPath.endsWith(migrationName)) {
try {
return new String(bundle.bytesForResourcePath(currentPath), _NSStringUtilities.UTF8_ENCODING);
}
catch (UnsupportedEncodingException e) {
log.error(e, e);
}
}