Skip to content

Commit d3dc5f0

Browse files
authored
Adjust tl_segment_patterns; make way_id nullable (#563)
1 parent c8f7528 commit d3dc5f0

4 files changed

Lines changed: 10 additions & 13 deletions

File tree

internal/generated/gqlout/generated.go

Lines changed: 3 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

schema/graphql/schema.graphqls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1243,7 +1243,7 @@ type SegmentPattern {
12431243
"Shape ID for this segment pattern"
12441244
shape_id: Int!
12451245
"OSM Way ID, if any, associated with this segment pattern"
1246-
way_id: Int!
1246+
way_id: Int
12471247
"Shape associated with this segment pattern"
12481248
shape: Shape!
12491249
"Segment geometry for this pattern"

schema/postgres/migrations/20260115170510_segments_sequence_idx.up.pgsql

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@ ADD COLUMN IF NOT EXISTS sequence_idx integer NOT NULL DEFAULT 0;
1515
ALTER TABLE tl_segment_patterns
1616
ADD COLUMN IF NOT EXISTS way_id bigint;
1717

18+
create index on tl_segment_patterns(way_id);
19+
create index on tl_segments(way_id);
20+
1821
-- Populate way_id from existing segments data (cast from text to bigint)
1922
UPDATE tl_segment_patterns sp
2023
SET way_id = s.way_id::bigint
2124
FROM tl_segments s
2225
WHERE sp.segment_id = s.id;
2326

2427
-- Make way_id non-null after populating
25-
ALTER TABLE tl_segment_patterns
26-
ALTER COLUMN way_id SET NOT NULL;
28+
-- ALTER TABLE tl_segment_patterns
29+
-- ALTER COLUMN way_id SET NOT NULL;
2730

2831
-- Drop old unique constraint that doesn't include sequence_idx
2932
-- Old: (segment_id, route_id, shape_id, stop_pattern_id)

server/model/models_gen.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)