Commit bb00fccf authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch 'migration-script-issues' into 'master'

Migration script issues

See merge request !1289
parents 407e5243 b035e206
Pipeline #39003 failed with stage
in 41 minutes and 6 seconds
......@@ -78,7 +78,11 @@ public abstract class V16_0_0_20200922_2__generic_article_data_migration extends
insert.setString(3, article.getJournal());
insert.setString(4, article.getLink());
insert.setString(5, article.getTitle());
insert.setInt(6, article.getYear());
if (article.getYear() == null) {
insert.setNull(6, Types.INTEGER);
} else {
insert.setInt(6, article.getYear());
}
if (insert.executeUpdate() == 0) {
logger.error("Problem with migrating cached article data: " + xmlArticle);
} else {
......@@ -104,7 +108,7 @@ public abstract class V16_0_0_20200922_2__generic_article_data_migration extends
}
}
} catch (Exception e) {
logger.error("Problem with migrating cached article data: " + xmlArticle);
logger.error("Problem with migrating cached article data: " + xmlArticle, e);
}
}
}
......@@ -113,7 +117,7 @@ public abstract class V16_0_0_20200922_2__generic_article_data_migration extends
}
try (Statement select = context.getConnection().createStatement()) {
select.executeQuery("delete from cache_query_table where query like 'pubmed:%'");
select.executeUpdate("delete from cache_query_table where query like 'pubmed:%'");
} catch (Exception e) {
logger.error("Problem with purgining cached article data", e);
}
......
......@@ -98,6 +98,10 @@ public abstract class V16_0_0_20200930_2__generic_data_overlay_entry_data extend
private void addEntries(Integer overlayId, Set<? extends DataOverlayEntry> entries, Context context)
throws SQLException {
for (DataOverlayEntry dataOverlayEntry : entries) {
if (dataOverlayEntry.getName() != null && dataOverlayEntry.getName().length() > 255) {
logger.warn("Data overlay entry with too long name. Skipping: \"" + dataOverlayEntry.getName() + "\"");
continue;
}
String distinguisher = "GENERIC_DATA_OVERLAY";
if (dataOverlayEntry instanceof GeneVariantDataOverlayEntry) {
distinguisher = "GENE_VARIANT_DATA_OVERLAY";
......@@ -325,7 +329,7 @@ public abstract class V16_0_0_20200930_2__generic_data_overlay_entry_data extend
result.add(extractGenericEntry(entry, columns, line.split("\t", -1)));
} catch (Exception e) {
logger.error("Problem with creating entry. Line:\n" + line + "\nColumns: "
+ StringUtils.join(Arrays.asList(columns), "\t"));
+ StringUtils.join(Arrays.asList(columns), "\t"), e);
}
}
line = br.readLine();
......@@ -342,7 +346,7 @@ public abstract class V16_0_0_20200930_2__generic_data_overlay_entry_data extend
for (int i = 0; i < columns.length; i++) {
String column = columns[i].trim().toLowerCase();
String value = null;
//there might be some broken entries
// there might be some broken entries
if (data.length > i) {
value = data[i];
}
......@@ -425,7 +429,7 @@ public abstract class V16_0_0_20200930_2__generic_data_overlay_entry_data extend
}
break;
case "color":
entry.setColor(colorParser.parse(value));
entry.setColor(colorParser.parse(value.trim()));
break;
case "references":
case "identifier":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment