-
Notifications
You must be signed in to change notification settings - Fork 974
feat(schema): add platform columns to contributors and fix data contamination (#3469) #3599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
guptapratykshh
wants to merge
1
commit into
chaoss:main
Choose a base branch
from
guptapratykshh:fix/cross-contamination-3469
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
augur/application/schema/alembic/versions/39_add_platform_columns_to_contributors.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| """add platform data to contributors | ||
|
|
||
| Revision ID: 39 | ||
| Revises: 38 | ||
| Create Date: 2026-01-16 14:00:00.000000 | ||
|
|
||
| """ | ||
| from alembic import op | ||
| import sqlalchemy as sa | ||
| from sqlalchemy.sql import text | ||
|
|
||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = '39' | ||
| down_revision = '38' | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade(): | ||
| # Add columns to augur_data.contributors | ||
| op.add_column('contributors', sa.Column('platform', sa.String(), nullable=False, server_default='github'), schema='augur_data') | ||
| op.add_column('contributors', sa.Column('platform_username', sa.String(), nullable=True), schema='augur_data') | ||
|
|
||
| # Backfill platform_username from gh_login for the default 'github' platform entries | ||
| # We use execute with text() for safe SQL execution | ||
| connection = op.get_bind() | ||
| connection.execute(text("UPDATE augur_data.contributors SET platform_username = gh_login WHERE platform = 'github'")) | ||
|
|
||
|
|
||
| def downgrade(): | ||
| op.drop_column('contributors', 'platform_username', schema='augur_data') | ||
| op.drop_column('contributors', 'platform', schema='augur_data') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is platform username for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
platform_username is the platform agnostic column intended to serve as unified source of truth for contributor's handle/login, regardless of source.
row with platform='github' stores login in platform_username, row with platform='gitlab' also stores login in platform_username.
this decouples our data model from specific platforms. when we add forgejo or bitbucket later, we wo not need to add forgejo_username columns, we will just use platform='forgejo' and platform_username.