Keep authority.kind CHECK in sync with the AuthorityKind enum #9

Closed
opened 2026-06-02 07:07:49 +00:00 by logaritmisk · 0 comments
Owner

The allowed authority kinds live in two places with no compile-time link:

  • SQL: CHECK (kind IN ('person', 'organisation', 'place')) in crates/db/migrations/0002_vocabularies_authorities.sql
  • Rust: AuthorityKind (as_str/from_db) in crates/domain/src/authority.rs

They agree today, but adding a variant requires editing both by hand. Same pattern applies to AuditAction vs the action CHECK in 0001. Low priority; options: a cross-referencing comment in each location, or generate the CHECK list from the enum. Revisit if the variant sets grow.

Source: Plan 2 (vocab/authorities) final review — non-blocking.

The allowed authority kinds live in two places with no compile-time link: - SQL: `CHECK (kind IN ('person', 'organisation', 'place'))` in `crates/db/migrations/0002_vocabularies_authorities.sql` - Rust: `AuthorityKind` (`as_str`/`from_db`) in `crates/domain/src/authority.rs` They agree today, but adding a variant requires editing both by hand. Same pattern applies to `AuditAction` vs the `action` CHECK in 0001. Low priority; options: a cross-referencing comment in each location, or generate the CHECK list from the enum. Revisit if the variant sets grow. _Source: Plan 2 (vocab/authorities) final review — non-blocking._
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: logaritmisk/biggus-dickus#9