Skip to content

Conversation

@youngkidwarrior
Copy link
Collaborator

Why:
Refactor from storing balance_rank_percentile (numeric 0-100) to storing
raw balance_rank (integer, 0-based). This provides more flexibility for
clients to calculate percentile, percentage, or other transformations
on-demand using the formula: (rank / (total_count - 1)) * 100

Changes:

  • Column: balance_rank_percentile numeric(5,2) → balance_rank integer
  • Migration updated with new column name and type
  • Schema definition updated
  • Comment updated with client-side calculation guidance

Example pattern from: supabase/migrations/20231017213200_add_index_to_distribution_shares.sql (line 2)
which shows adding integer columns to distribution_shares table.

Test plan:

  • Apply migration: supabase db push
  • Verify column: SELECT column_name, data_type FROM information_schema.columns WHERE table_name='distribution_shares' AND column_name='balance_rank'
    Expected: column_name='balance_rank', data_type='integer'

Why:
Refactor from storing balance_rank_percentile (numeric 0-100) to storing
raw balance_rank (integer, 0-based). This provides more flexibility for
clients to calculate percentile, percentage, or other transformations
on-demand using the formula: (rank / (total_count - 1)) * 100

Changes:
- Column: balance_rank_percentile numeric(5,2) → balance_rank integer
- Migration updated with new column name and type
- Schema definition updated
- Comment updated with client-side calculation guidance

Example pattern from: supabase/migrations/20231017213200_add_index_to_distribution_shares.sql (line 2)
which shows adding integer columns to distribution_shares table.

Test plan:
- Apply migration: supabase db push
- Verify column: SELECT column_name, data_type FROM information_schema.columns WHERE table_name='distribution_shares' AND column_name='balance_rank'
  Expected: column_name='balance_rank', data_type='integer'
Copy link
Collaborator Author

youngkidwarrior commented Dec 30, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants