Skip to content

Commit

Permalink
Error early on non globally unique node IDs (#1311)
Browse files Browse the repository at this point in the history
Alleviates #1262

This code will need to be removed again when that is fixed.
  • Loading branch information
visr authored Mar 25, 2024
1 parent 0acbbed commit bee3d39
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/src/model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ function Model(config::Config)::Model
state = load_structvector(db, config, BasinStateV1)
n = length(get_ids(db, "Basin"))

sql = "SELECT node_id FROM Node ORDER BY node_id"
node_id = only(execute(columntable, db, sql))
if !allunique(node_id)
error(
"Node IDs need to be globally unique until https://github.com/Deltares/Ribasim/issues/1262 is fixed.",
)
end
finally
# always close the database, also in case of an error
close(db)
Expand Down

0 comments on commit bee3d39

Please sign in to comment.