Skip to content

Commit

Permalink
hack 2
Browse files Browse the repository at this point in the history
  • Loading branch information
aguiraf committed Dec 23, 2024
1 parent 1d2a439 commit b0928eb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/com/conveyal/gtfs/loader/JdbcTableWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,17 @@ public String update(Integer id, String json, boolean autoCommit) throws SQLExce
// 5T: hacky hack hack to add calendar_dates table if we're updating a calendar.
if (specTable.name.equals("calendars")) {
referencingTables.add(Table.CALENDAR_DATES);
System.out.println("Ho appena aggiunto calendar_dates alle referencingTables");
}
// Iterate over referencing (child) tables and update those rows that reference the parent entity with the
// JSON array for the key that matches the child table's name (e.g., trip.stop_times array will trigger
// update of stop_times with matching trip_id).
for (Table referencingTable : referencingTables) {
Table parentTable = referencingTable.getParentTable();
if (parentTable != null && parentTable.name.equals(specTable.name) || referencingTable.name.equals("shapes")) {
if (parentTable != null && parentTable.name.equals(specTable.name) || referencingTable.name.equals("shapes")
//5t
|| referencingTable.name.equals("calendar_dates")
) {
// If a referencing table has the current table as its parent, update child elements.
JsonNode childEntities = jsonObject.get(referencingTable.name);
if (childEntities == null || childEntities.isNull() || !childEntities.isArray()) {
Expand Down

0 comments on commit b0928eb

Please sign in to comment.