Skip to content
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

Simplify interface to database module #156

Closed
wants to merge 8 commits into from
Closed

Conversation

lorenyu
Copy link
Collaborator

@lorenyu lorenyu commented Jan 17, 2025

Ticket

Resolves navapbc/template-infra#752
Contributes to navapbc/template-infra#726

Changes

  • Reduce the number of configurable parameters to the database module by:
    • Reorganizing /infra/modules/database to be a folder of two modules, a "resources" module and a "data" module
    • Move the current database module to be the "resources" module
    • Move all database-related data sources in the service later to be the "data" module
    • Move most database-related parameters in app-config to an internal "interface" module that root modules don't need to know about

Benefits of this approach is that it:

  • Simplifies app-config to only configurations that are intended to be updated by the project vs configurations that are only there to facilitate dependencies between root module
  • Encapsulates the data sources in the service layer's root module
  • Simplifies the creation of the database itself in the database root module

Context for reviewers

See description in changes, but this is a new architectural design I've been discussing with @rocketnova last year that was born out of an idea by @sonicos . I think it solves a couple of problems at once. In addition to simplifying data source access it also helps address the problem stated in navapbc/template-infra#726.

This is purely a refactor PR, there are no functional changes.

Testing

Running make infra-update-app-database APP_NAME=app ENVIRONMENT=dev only no diff except for a last_modified timestamp on a file due to moving the database module from /modules/database to /modules/database/resources
image

Running make infra-update-app-service shows no changes
image

Preview environment

♻️ Environment destroyed ♻️

@lorenyu
Copy link
Collaborator Author

lorenyu commented Jan 18, 2025

Done in navapbc/template-infra#841

@lorenyu lorenyu closed this Jan 18, 2025
@lorenyu lorenyu deleted the lorenyu/datamodule branch January 18, 2025 00:27
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.

Modularize database module
2 participants