Skip to content

AAI-119 Initialize user management database#34

Merged
marius-mather merged 19 commits into
mainfrom
db-init
Jul 1, 2025
Merged

AAI-119 Initialize user management database#34
marius-mather merged 19 commits into
mainfrom
db-init

Conversation

@marius-mather

@marius-mather marius-mather commented Jun 30, 2025

Copy link
Copy Markdown
Collaborator

Description

AAI-119: set up an initial database with sqlmodel/sqlalchemy

Changes

  • Use sqlmodel to set up and configure a database that can be used with FastAPI
  • Allow choosing the database to connect to with environment variables
  • Set up a database on AWS and update deployment scripts so that we use it when the app is deployed
  • Set up alembic so we can track DB migrations. NOTE: have not created the initial migrations yet, as this is best done once the app is deployed and we can generate the migrations against the AWS database.
  • Initial GroupMembership DB model so we have a data model we can test
  • Configure the test environment to use a separate in-memory database
  • Unit tests of setup and models

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)

Set DB_URL in the .env file, e.g. DB_URL=sqlite:///database.db. Run uv run pytest to run unit tests.

amandazhuyilan
amandazhuyilan previously approved these changes Jun 30, 2025

@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.

Thanks - overall looks good. One question: is the intention that we eventually move / upgrade our current schemas (ex: BPARegistrationRequest) to the db/models.py?

Comment thread migrations/env.py Outdated
@marius-mather

Copy link
Copy Markdown
Collaborator Author

Thanks - overall looks good. One question: is the intention that we eventually move / upgrade our current schemas (ex: BPARegistrationRequest) to the db/models.py?

Not all schemas, just the schemas for data we store in Auth0 metadata. We would still have pydantic schemas for the data we send/receive in web requests. We can start porting the Auth0 metadata over to the DB, we should just work out exactly what we still need, e.g. do we still need resources?

@amandazhuyilan

Copy link
Copy Markdown
Contributor

We can start porting the Auth0 metadata over to the DB, we should just work out exactly what we still need, e.g. do we still need resources?

Good point - I think from the direction conversations are moving with BPA and Galaxy, we won't be needing a resources section anymore. We can first merge this PR in, and in the next PR to port Auth0 metadata into the DB, while we can work out the details on how the data schema of the database data looks like. What do you think?

@marius-mather

Copy link
Copy Markdown
Collaborator Author

Yes, let's merge this in, and work out exactly what data we need in the DB in a future ticket.

@marius-mather marius-mather merged commit 5c652f8 into main Jul 1, 2025
1 check passed
@amandazhuyilan amandazhuyilan deleted the db-init branch June 19, 2026 03:21
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