From f764128a578d5c778b03b7c66a65b0827f877617 Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Fri, 4 Dec 2026 16:01:49 +0100 Subject: [PATCH] Explain the "why" --- src/velofy/db/pixels.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/velofy/db/pixels.py b/src/velofy/db/pixels.py index f3a1e02..c7ff9df 100644 --- a/src/velofy/db/pixels.py +++ b/src/velofy/db/pixels.py @@ -59,7 +59,8 @@ class Pixel(meta.Base): ), sa.CheckConstraint("0 <= n_x", name="n_x_is_positive"), sa.CheckConstraint("0 <= n_y", name="n_y_is_positive"), - # Needed by a `ForeignKeyConstraint` in `AddressPixelAssociation` + # The foreign key in `AddressPixelAssociation` refers to this pair + # => Its `.grid_id` always matches the `Pixel`'s `.grid` sa.UniqueConstraint("id", "grid_id"), # Each coordinate within the same `grid` is used at most once sa.UniqueConstraint("grid_id", "n_x", "n_y"),