This commit is contained in:
Shubhankar45
2026-10-27 12:03:31 +00:00
parent 2ed3945b5d
commit 4e5e95775d
104 changed files with 5210 additions and 606 deletions
+5 -3
View File
@@ -56,15 +56,17 @@ class Headquarters(Base, UUIDMixin, TimestampMixin):
class AMHeadquarters(Base, UUIDMixin, TimestampMixin):
"""Which Area Manager currently manages which headquarters.
`effective_to IS NULL` means "current". A partial unique index guarantees at most
one active Area Manager per headquarters at any time.
`effective_to IS NULL` means "current". A headquarters may have several Area Managers
and an Area Manager several headquarters; the partial unique index only stops the same
pair being active twice.
"""
__tablename__ = "am_headquarters"
__table_args__ = (
Index(
"uq_active_am_per_hq",
"uq_active_am_hq_pair",
"headquarters_id",
"area_manager_user_id",
unique=True,
postgresql_where=text("effective_to IS NULL"),
),