AAI-301 database models and migrations for redesigned user database#48
Merged
Conversation
…tomatic memberships
Contributor
There was a problem hiding this comment.
Pull Request Overview
Updates database models and migrations for a redesigned user database structure that better integrates with Auth0, introducing proper foreign key relationships and history tracking for group and platform memberships.
- Replaces
BiocommonsAuth0Userschema withAuth0UserDataand introduces newBiocommonsUserdatabase model - Adds platform membership tracking with
PlatformMembershipandPlatformMembershipHistorymodels - Refactors group membership models to use proper foreign key relationships instead of storing user data directly
Reviewed Changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_utils.py | Updates factory references from BiocommonsAuth0UserFactory to Auth0UserDataFactory |
| tests/test_user.py | Updates factory references and test data structures |
| tests/test_galaxy.py | Updates factory references |
| tests/test_auth0_client.py | Updates factory references |
| tests/test_admin.py | Updates factory references and removes unused Auth0 client fixture |
| tests/db/test_models.py | Adds comprehensive tests for new database models including user creation, platform memberships, and history tracking |
| tests/db/datagen.py | Adds BiocommonsUserFactory for test data generation |
| tests/datagen.py | Renames factory class and adds proper sub field generation |
| tests/conftest.py | Updates test configuration with new factories and database session handling |
| tests/biocommons/test_api.py | Updates tests to use new database models and relationships |
| scripts/generate_db_diagram.py | New script for generating database diagrams |
| schemas/biocommons.py | Renames BiocommonsAuth0User to Auth0UserData and adds username field |
| routers/user.py | Updates to use new Auth0UserData schema |
| routers/biocommons_groups.py | Refactors to use new database models with proper relationships |
| routers/admin.py | Updates to use new Auth0UserData schema |
| migrations/versions/ | New migration files for updated database schema |
| generate_db_diagram.sh | Script for generating database diagrams |
| db/models.py | Major refactor introducing new user model, platform memberships, and proper foreign key relationships |
| db/admin.py | Updates admin interface for renamed models |
| auth0/client.py | Updates to use new Auth0UserData schema |
Comments suppressed due to low confidence (1)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
amandazhuyilan
left a comment
Contributor
There was a problem hiding this comment.
Overall looks great - only nit picking again on naming and the diagram
amandazhuyilan
approved these changes
Aug 12, 2025
amandazhuyilan
left a comment
Contributor
There was a problem hiding this comment.
Awesome - lets ship it 🚀
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
AAI-301: create database models for the new user database design, and create new migrations
Changes
Checklist
How to Test Manually (if necessary)
Run
uv run pytestanduv run python generate_migrations.py --check