Skip to content

AAI-301 database models and migrations for redesigned user database#48

Merged
marius-mather merged 35 commits into
mainfrom
user-db
Aug 12, 2025
Merged

AAI-301 database models and migrations for redesigned user database#48
marius-mather merged 35 commits into
mainfrom
user-db

Conversation

@marius-mather

@marius-mather marius-mather commented Aug 11, 2025

Copy link
Copy Markdown
Collaborator

Description

AAI-301: create database models for the new user database design, and create new migrations

Changes

  • New database models
  • Updated/refreshed migrations
  • Unit tests of model creation

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • I have added unit / integration tests that prove my fix is effective or that my feature works
  • I have run all tests locally and they pass
  • I have updated the documentation (if applicable)

How to Test Manually (if necessary)

Run uv run pytest and uv run python generate_migrations.py --check

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 BiocommonsAuth0User schema with Auth0UserData and introduces new BiocommonsUser database model
  • Adds platform membership tracking with PlatformMembership and PlatformMembershipHistory models
  • 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)

Comment thread tests/datagen.py Outdated
Comment thread tests/db/test_models.py Outdated
Comment thread tests/db/test_models.py Outdated
Comment thread routers/biocommons_groups.py Outdated
marius-mather and others added 5 commits August 11, 2025 16:42
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 amandazhuyilan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks great - only nit picking again on naming and the diagram

Comment thread db/models.py Outdated
Comment thread db_diagram.svg

@amandazhuyilan amandazhuyilan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome - lets ship it 🚀

@marius-mather marius-mather merged commit ea47823 into main Aug 12, 2025
2 checks passed
@amandazhuyilan amandazhuyilan deleted the user-db branch June 19, 2026 03:22
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.

3 participants