Explain the "why"

This commit is contained in:
Alexander Hess 2026-12-04 16:01:49 +01:00
commit f764128a57
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -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"),