Skip to content

Migrate registration policies from JSONB to database tables #11238

@nbudin

Description

@nbudin

Background

Registration policies (and their buckets) are currently stored as JSONB objects on the events table. This makes it impossible to enforce referential integrity on fields like bucket_key and requested_bucket_key in signups, signup_requests, and signup_ranked_choices — they're just free-text strings that reference a key in a JSON blob.

This has caused real problems: #11229 was filed because changes to bucket keys could silently invalidate those references, and we had to add application-level logic to detect and remap them.

Proposed Change

Extract registration policies and their buckets into proper database tables:

  • registration_policies table (belongs to event)
  • registration_policy_buckets table (belongs to registration_policy, has key, name, description, slots_limited, total_slots, minimum_slots, preferred_slots, anything, not_counted, etc.)

Then migrate bucket_key and requested_bucket_key on signups, signup_requests, and signup_ranked_choices to be integer foreign key columns referencing registration_policy_buckets.

Benefits

Considerations

  • This is a significant migration — the JSONB serialization is used throughout the codebase (GraphQL types, forms, services)
  • The RegistrationPolicy and RegistrationPolicy::Bucket value objects would need to either be replaced or backed by ActiveRecord models
  • The EventChangeRegistrationPolicyService logic would need to be revisited
  • Liquid drops and other serialization points would need updating

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Next

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions