Skip to content

Commit

Permalink
refactor(Ordering to meet referential integrity): shapes are now load…
Browse files Browse the repository at this point in the history
…ed before patterns
  • Loading branch information
Robin Beer authored and Robin Beer committed Sep 1, 2023
1 parent 6122629 commit 8e28e09
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/main/java/com/conveyal/gtfs/loader/JdbcGtfsLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,16 @@ public FeedLoadResult loadTables() {
// This allows everything to work even when there's no prefix.
this.tablePrefix += ".";
}
// Load each table in turn, saving some summary information about what happened during each table load
// Load each table in turn, saving some summary information about what happened during each table load.
// The loading order is needed for referential integrity.
result.agency = load(Table.AGENCY);
result.calendar = load(Table.CALENDAR);
result.calendarDates = load(Table.CALENDAR_DATES);
result.routes = load(Table.ROUTES);
result.fareAttributes = load(Table.FARE_ATTRIBUTES);
result.feedInfo = load(Table.FEED_INFO);
result.patterns = load(Table.PATTERNS);
result.shapes = load(Table.SHAPES);
result.patterns = load(Table.PATTERNS); // refs shapes and routes.
result.stops = load(Table.STOPS);
result.fareRules = load(Table.FARE_RULES);
result.transfers = load(Table.TRANSFERS);
Expand Down
2 changes: 0 additions & 2 deletions src/test/java/com/conveyal/gtfs/GTFSTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ public void canLoadAndExportSimpleAgency() {
ErrorExpectation[] fakeAgencyErrorExpectations = ErrorExpectation.list(
new ErrorExpectation(NewGTFSErrorType.MISSING_FIELD),
new ErrorExpectation(NewGTFSErrorType.REFERENTIAL_INTEGRITY),
new ErrorExpectation(NewGTFSErrorType.REFERENTIAL_INTEGRITY),
new ErrorExpectation(NewGTFSErrorType.ROUTE_LONG_NAME_CONTAINS_SHORT_NAME),
new ErrorExpectation(NewGTFSErrorType.FEED_TRAVEL_TIMES_ROUNDED),
new ErrorExpectation(NewGTFSErrorType.STOP_UNUSED, equalTo("1234567")),
Expand Down Expand Up @@ -272,7 +271,6 @@ public void canLoadAndExportSimpleAgencyInSubDirectory() throws IOException {
new ErrorExpectation(NewGTFSErrorType.TABLE_IN_SUBDIRECTORY),
new ErrorExpectation(NewGTFSErrorType.TABLE_IN_SUBDIRECTORY),
new ErrorExpectation(NewGTFSErrorType.TABLE_IN_SUBDIRECTORY),
new ErrorExpectation(NewGTFSErrorType.REFERENTIAL_INTEGRITY),
new ErrorExpectation(NewGTFSErrorType.TABLE_IN_SUBDIRECTORY),
new ErrorExpectation(NewGTFSErrorType.TABLE_IN_SUBDIRECTORY),
new ErrorExpectation(NewGTFSErrorType.TABLE_IN_SUBDIRECTORY),
Expand Down

0 comments on commit 8e28e09

Please sign in to comment.