Skip to content

Commit 566c751

Browse files
suvikankarejannebe
authored andcommitted
update infraLinks.sql to Digiroad 2025-02 routes and move to Azure
1 parent d19e9d8 commit 566c751

File tree

16 files changed

+85
-158792
lines changed

16 files changed

+85
-158792
lines changed

.github/workflows/check-generated-resources.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,10 @@ jobs:
3939
run: yarn ws:codegen generate
4040

4141
- name: Verify that generate command made no changes, so schema is up to date
42-
run: '[ -z "$(git status --porcelain)" ]'
42+
run: |
43+
STATUS=$(git status --porcelain)
44+
echo "Git status output:"
45+
echo "$STATUS"
46+
echo "=== Git diff ==="
47+
git diff
48+
[ -z "$(git status --porcelain)" ]

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@ tsconfig.tsbuildinfo
2424

2525
dump.sql
2626
*.pgdump
27+
infraLinks.sql
28+
infra_links_data.sql
29+
30+
.DS_Store

.gitmodules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[submodule "jore4-hasura"]
22
path = jore4-hasura
33
url = https://github.com/HSLdevcom/jore4-hasura
4+
branch = digiraod_links

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ To update database dump files (with the `.pgdump` extension), do the following:
213213

214214
## Regenerating infraLinks.sql
215215

216-
After updating dump file for the network & routes database, you may consider updating the seed data for infrastructure links which is located at `./test-db-manager/src/dumps/infraLinks/infraLinks.sql`.
216+
After updating dump file for the network & routes database, you may consider updating the seed data for infrastructure links which is located in azure blob storage stjore4dev001's jore4-dump container. Download with `scripts/development.sh infralink:download`, after which the file is at `./infraLinks.sql`.
217217

218218
To do that:
219219

@@ -226,6 +226,7 @@ To do that:
226226
COPY infrastructure_network.infrastructure_link (infrastructure_link_id, direction, shape, estimated_length_in_metres, external_link_id, external_link_source) FROM stdin;
227227
```
228228
- Copy the command and the immediately following rows of data (over 150 000 rows in total) and replace the same command in the `infraLinks.sql` file to update infrastructure seed data. Make sure you only copy infrastructure link data!
229+
- upload the infraLinks.sql to azure (stjore4dev001's jore4-dump container) and update the location to development.sh (INFRALINKS_FILENAME constant).
229230

230231
### Fixing timetables seed data (NEEDS UPDATE)
231232

cypress/datasets/base.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ import { DateTime } from 'luxon';
1919
import { UUID } from '../types';
2020

2121
export const testInfraLinkExternalIds = [
22-
'442321', // on Annankatu, between Bulevardi and Lönnrotinkatu and
23-
'442326', // on Annankatu, between Lönnrotinkatu and Kalevankatu
24-
'442317', // on Kalevankatu, between Annankatu and Fredrikinkatu
25-
'442027', // on Kalevankatu, between Fredrikinkatu and Albertinkatu
26-
'442438', // on Albertinkatu, between Kalevankatu and Lönnrotinkatu (one-way)
27-
'445113', // on Lönnrotinkatu, between Albertinkatu and Abrahaminkatu (one-way)
28-
'445118', // on Abrahaminkatu, between Lönnrotinkatu and Kalevankatu
29-
'442423', // on Kalevankatu, between Abrahaminkatu and Albertinkatu
22+
'145c33b2-5d2a-4668-b922-6117408772e0:1', // on Annankatu, between Bulevardi and Lönnrotinkatu and
23+
'f8af6fe3-b711-4365-aad9-54a59b26a8aa:1', // on Annankatu, between Lönnrotinkatu and Kalevankatu
24+
'11b3a892-22a8-49b0-b2f7-0dae577f46ca:1', // on Kalevankatu, between Annankatu and Fredrikinkatu
25+
'd9920aa3-748f-486b-8a44-7c07e55a9d08:1', // on Kalevankatu, between Fredrikinkatu and Albertinkatu
26+
'f7953bf5-7bee-426b-a6cb-7b136236630b:1', // on Albertinkatu, between Kalevankatu and Lönnrotinkatu (one-way)
27+
'87c2fbd0-697c-460a-ab38-8b0b41eeead1:1', // on Lönnrotinkatu, between Albertinkatu and Abrahaminkatu (one-way)
28+
'a87caa98-2d9d-45fa-9dff-3909b7d7d763:1', // on Abrahaminkatu, between Lönnrotinkatu and Kalevankatu
29+
'1b0dcad2-a363-482d-a630-5ef8cfcd0fec:1', // on Kalevankatu, between Abrahaminkatu and Albertinkatu
3030
];
3131

3232
const timingPlaces = [

cypress/e2e/stop-registry/stopDetails.cy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ import { InsertedStopRegistryIds } from '../utils';
5353

5454
const testInfraLinks = [
5555
{
56-
externalId: '445156',
56+
externalId: '7d29bd61-6cf7-4d2c-8bd8-b8e835fe90b7:1',
5757
coordinates: [24.92669962, 60.16418108, 10.09699999],
5858
},
5959
{
60-
externalId: '442424',
60+
externalId: 'cbe70fa1-8797-4dd4-b264-5a69f2ddcfc9:1',
6161
coordinates: [24.92904198, 60.16490775, 0],
6262
},
6363
{
64-
externalId: '442325',
64+
externalId: 'c1e17eee-96d6-4d83-91d2-51512318bff2:1',
6565
coordinates: [24.93207242, 60.16600322, 0],
6666
},
6767
];

docker/docker-compose.custom.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,13 @@ services:
4444
# Pin timetables api to a compatible version.
4545
# Note: also update jore4-timetablesapi-e2e in docker-compose.e2e when changing this.
4646
image: 'hsldevcom/jore4-timetables-api:main--20240905-da293a99ddeff4776bc7c20d675832b0a407fe9f'
47+
48+
jore4-mapmatchingdb:
49+
environment:
50+
DIGIROAD_ROUTING_DUMP_URL: "https://stjore4dev001.blob.core.windows.net/jore4-digiroad/2025-08-29_create_routing_schema_digiroad_r_2025_02_fixup.sql"
51+
52+
jore4-hasura-e2e:
53+
image: 'crjore4prod001.azurecr.io/jore4-generic-hasura:digiroad_links-2025-11-03-919d977c5ed6e07087119b16b3bb00f6dc672428'
54+
55+
jore4-hasura-base:
56+
image: 'crjore4prod001.azurecr.io/jore4-generic-hasura:digiroad_links-2025-11-03-919d977c5ed6e07087119b16b3bb00f6dc672428'

jore4-hasura

scripts/development.sh

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ DOCKER_COMPOSE_BUNDLE_REF=${BUNDLE_REF:-main}
1616
# this project from others.
1717
export COMPOSE_PROJECT_NAME=jore4-ui
1818

19-
DUMP_ROUTES_FILENAME="2025-04-03_test/2025-04-03-jore4-local-jore4e2e.pgdump"
20-
DUMP_TIMETABLES_FILENAME="2025-04-03_test/2025-04-03-jore4-local-timetablesdb-nodata.pgdump"
21-
DUMP_STOPS_FILENAME="2025-04-03_test/2025-04-03-jore4-local-stopdb.pgdump"
19+
DUMP_ROUTES_FILENAME="2025-09-24_local_test/2025-09-24-jore4-local-jore4e2e.pgdump"
20+
DUMP_TIMETABLES_FILENAME="2025-09-24_local_test/2025-09-24-jore4-local-timetablesdb-nodata.pgdump"
21+
DUMP_STOPS_FILENAME="2025-09-24_local_test/2025-09-24-jore4-local-stopdb.pgdump"
22+
INFRALINKS_FILENAME="2025-09-24_local_test/2025-09-24-infraLinks.sql"
2223

2324
DOCKER_TESTDB_IMAGE="jore4-testdb"
2425
DOCKER_IMAGES=("jore4-auth" "jore4-hasura" "jore4-mbtiles" "jore4-mapmatchingdb" "jore4-mapmatching" "jore4-hastus" "jore4-tiamat" "jore4-timetablesapi")
@@ -71,11 +72,27 @@ wait_for_database() {
7172
done
7273
}
7374

75+
download_infralinks() {
76+
infralinks_localfile=$(basename "$INFRALINKS_FILENAME")
77+
if [ -f "infraLinks.sql" ]; then
78+
echo "infraLinks.sql already exists, skipping download."
79+
return
80+
fi
81+
if [ ! -f "$infralinks_localfile" ]; then
82+
echo "Downloading infrastructure links..."
83+
download_dump "$INFRALINKS_FILENAME"
84+
fi
85+
echo "Renaming downloaded infrastructure links to infraLinks.sql..."
86+
mv "$infralinks_localfile" "infraLinks.sql"
87+
}
88+
7489
seed_infra_links() {
90+
download_infralinks
91+
7592
echo "$1: Seeding infrastructure links..."
7693

7794
wait_for_database "$1" infrastructure_network infrastructure_link
78-
docker exec -i "$1" psql $ROUTES_DB_CONNECTION_STRING < test-db-manager/src/dumps/infraLinks/infraLinks.sql;
95+
docker exec -i "$1" psql $ROUTES_DB_CONNECTION_STRING < "infraLinks.sql";
7996
}
8097

8198
check_pinned_image() {
@@ -236,6 +253,7 @@ download_dump() {
236253
--container-name "jore4-dump" \
237254
--name "$az_blob_filepath" \
238255
--file "$(basename "$az_blob_filepath")" \
256+
--output none \
239257
--auth-mode login
240258
fi
241259
}
@@ -373,6 +391,10 @@ print_usage() {
373391
the BUNDLE_REF environment variable. By default, the latest version is
374392
downloaded.
375393
394+
infralinks:download
395+
Downloads the infrastructure links seed data SQL file (infraLinks.sql) from Azure
396+
Blob Storage.
397+
376398
dump:download [<azure_blob_filepath>]
377399
Downloads a JORE4 database dump from Azure Blob Storage. A full file path
378400
may be given as a parameter. The file path is used to refer to a file inside
@@ -421,12 +443,16 @@ setup:test)
421443
setup_environment test
422444
;;
423445

446+
infralinks:download)
447+
download_infralinks
448+
;;
449+
424450
dump:download)
425451
download_dump
426452
;;
427453

428454
dump:import)
429-
import_dump
455+
import_dump "$2" "$3"
430456
;;
431457

432458
digitransit:fetch)

scripts/seed-infrastructure-links.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
#!/usr/bin/env bash
22

3+
if [ -z "$1" ]; then
4+
echo "Usage: $0 <docker_container_name>"
5+
exit 1
6+
fi
7+
38
cd "$(dirname "$0")"/..
49

10+
if [ ! -f infraLinks.sql ]; then
11+
./scripts/development.sh infralinks:download
12+
if [ ! -f infraLinks.sql ]; then
13+
echo "Failed to download infrastructure links data."
14+
exit 1
15+
fi
16+
fi
17+
518
DB_CONNECTION_STRING=postgresql://dbadmin:adminpassword@localhost:5432/jore4e2e
619

720
echo "$1: Seeding infrastructure links..."
@@ -11,7 +24,7 @@ while ! $SUCCESS; do
1124
echo "$1: Checking if infrastructure link schema exists..."
1225
if [[ $(docker exec $1 psql $DB_CONNECTION_STRING -AXqtc "SELECT EXISTS (SELECT FROM pg_tables WHERE schemaname = 'infrastructure_network' AND tablename = 'infrastructure_link');") = "t" ]]; then
1326
echo "$1: Schema found! Seeding infrastructure links..."
14-
docker exec -i $1 psql $DB_CONNECTION_STRING < test-db-manager/src/dumps/infraLinks/infraLinks.sql;
27+
docker exec -i $1 psql $DB_CONNECTION_STRING < infraLinks.sql;
1528
SUCCESS=true
1629
fi
1730
sleep 2

0 commit comments

Comments
 (0)