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 ...@@ -78,7 +78,11 @@ public abstract class V16_0_0_20200922_2__generic_article_data_migration extends
insert.setString(3, article.getJournal()); insert.setString(3, article.getJournal());
insert.setString(4, article.getLink()); insert.setString(4, article.getLink());
insert.setString(5, article.getTitle()); 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) { if (insert.executeUpdate() == 0) {
logger.error("Problem with migrating cached article data: " + xmlArticle); logger.error("Problem with migrating cached article data: " + xmlArticle);
} else { } else {
...@@ -104,7 +108,7 @@ public abstract class V16_0_0_20200922_2__generic_article_data_migration extends ...@@ -104,7 +108,7 @@ public abstract class V16_0_0_20200922_2__generic_article_data_migration extends
} }
} }
} catch (Exception e) { } 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 ...@@ -113,7 +117,7 @@ public abstract class V16_0_0_20200922_2__generic_article_data_migration extends
} }
try (Statement select = context.getConnection().createStatement()) { 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) { } catch (Exception e) {
logger.error("Problem with purgining cached article data", 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 ...@@ -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) private void addEntries(Integer overlayId, Set<? extends DataOverlayEntry> entries, Context context)
throws SQLException { throws SQLException {
for (DataOverlayEntry dataOverlayEntry : entries) { 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"; String distinguisher = "GENERIC_DATA_OVERLAY";
if (dataOverlayEntry instanceof GeneVariantDataOverlayEntry) { if (dataOverlayEntry instanceof GeneVariantDataOverlayEntry) {
distinguisher = "GENE_VARIANT_DATA_OVERLAY"; distinguisher = "GENE_VARIANT_DATA_OVERLAY";
...@@ -325,7 +329,7 @@ public abstract class V16_0_0_20200930_2__generic_data_overlay_entry_data extend ...@@ -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))); result.add(extractGenericEntry(entry, columns, line.split("\t", -1)));
} catch (Exception e) { } catch (Exception e) {
logger.error("Problem with creating entry. Line:\n" + line + "\nColumns: " 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(); line = br.readLine();
...@@ -342,7 +346,7 @@ public abstract class V16_0_0_20200930_2__generic_data_overlay_entry_data extend ...@@ -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++) { for (int i = 0; i < columns.length; i++) {
String column = columns[i].trim().toLowerCase(); String column = columns[i].trim().toLowerCase();
String value = null; String value = null;
//there might be some broken entries // there might be some broken entries
if (data.length > i) { if (data.length > i) {
value = data[i]; value = data[i];
} }
...@@ -425,7 +429,7 @@ public abstract class V16_0_0_20200930_2__generic_data_overlay_entry_data extend ...@@ -425,7 +429,7 @@ public abstract class V16_0_0_20200930_2__generic_data_overlay_entry_data extend
} }
break; break;
case "color": case "color":
entry.setColor(colorParser.parse(value)); entry.setColor(colorParser.parse(value.trim()));
break; break;
case "references": case "references":
case "identifier": 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