Skip to content

feat: add sheet_config_ids to Membership #5

Description

@ethnjs

Problem
Memberships have no record of which SheetConfig syncs have touched them. A membership can be updated by multiple configs over time (e.g. an interest form sets availability, a confirmation form sets lunch_order), so a single FK is not sufficient.

Solution
Add a nullable JSON column sheet_config_ids to the memberships table storing a list of config IDs that have synced into this membership:

sheet_config_ids = Column(JSON, nullable=True)  # [1, 3, 7, ...]

Tradeoff
No FK constraint — if a config is deleted, its ID becomes a stale reference in the list. Acceptable for now since this is provenance metadata, not a relational key. A proper M2M join table with ondelete cascade behavior can replace this later if referential integrity becomes important.

Unlocks

  • Know which configs have touched a membership
  • More accurate overlap warnings on config delete
  • "Synced from X configs" in volunteer list view

Files to change

  • app/models/models.py — add column
  • app/schemas/membership.py — add field to read schemas
  • app/services/sync_service.py — append config ID on upsert
  • New Alembic migration

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendbreaking-changeRemoves or alters existing behavior requiring a migration, coordination, or careful rolloutdatabaseUpdates database schemas or modelsenhancementNew feature or requestwontfixThis will not be worked on

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions