-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add sheet_config_ids to Membership #5
Copy link
Copy link
Open
Labels
backendbreaking-changeRemoves or alters existing behavior requiring a migration, coordination, or careful rolloutRemoves or alters existing behavior requiring a migration, coordination, or careful rolloutdatabaseUpdates database schemas or modelsUpdates database schemas or modelsenhancementNew feature or requestNew feature or requestwontfixThis will not be worked onThis will not be worked on
Description
Activity
Metadata
Metadata
Assignees
Labels
backendbreaking-changeRemoves or alters existing behavior requiring a migration, coordination, or careful rolloutRemoves or alters existing behavior requiring a migration, coordination, or careful rolloutdatabaseUpdates database schemas or modelsUpdates database schemas or modelsenhancementNew feature or requestNew feature or requestwontfixThis will not be worked onThis will not be worked on
Projects
- StatusShow more project fieldsTodo
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_idsto themembershipstable storing a list of config IDs that have synced into this membership: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
ondeletecascade behavior can replace this later if referential integrity becomes important.Unlocks
Files to change
app/models/models.py— add columnapp/schemas/membership.py— add field to read schemasapp/services/sync_service.py— append config ID on upsert