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

Configurable DB Schema Name #133

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

mwodahl
Copy link
Collaborator

@mwodahl mwodahl commented Jan 3, 2025

PR Details

Description

This PR modifies the cv-manager API to use a configurable database schema name instead of "public". By default the database schema used will still be "public", however, this allows a user to specify a different name if necessary. This issue arose during the WyoCV deployment of the cv-manager.

How Has This Been Tested?

These changes have been tested locally using docker compose. Additionally, all unit tests were verified to pass.

Types of changes

  • [ X ] Defect fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that cause existing functionality to change)

Checklist:

  • [ X ] My changes require new environment variables:
    • [ X ] I have updated the docker-compose, K8s YAML, and all dependent deployment configuration files.
  • [ X ] My changes require updates to the documentation:
    • [ X ] I have updated the documentation accordingly.
  • My changes require updates and/or additions to the unit tests:
    • I have modified/added tests to cover my changes.
  • [ X ] All existing tests pass.

Copy link
Member

@dmccoystephenson dmccoystephenson left a comment

Choose a reason for hiding this comment

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

question (blocking): There are still direct references to the public schema in the SQL scripts located in the resources/sql_scripts directory and in the resources/kubernetes/cv-manager-postgres.yaml file. Should we make these references configurable as well?

"JOIN public.rsus r ON ro.rsu_id = r.rsu_id "
f"FROM {schema_name}.rsu_organization ro "
f"JOIN {schema_name}.organizations o ON ro.organization_id = o.organization_id "
"JOIN {schema_name}.rsus r ON ro.rsu_id = r.rsu_id "
Copy link
Member

Choose a reason for hiding this comment

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

question (blocking): does this line need f as well?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It definitely should.

Copy link
Collaborator

@drewjj drewjj left a comment

Choose a reason for hiding this comment

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

I am not entirely convinced this should be customizable. I do see how leaving it as the default public schema name may not be desirable. In my opinion we should probably just change it to something custom instead of allowing complete customization.

The way this is implemented is great because it does support the customization of the pg schema but I think it is a little too free form to expect the implementer to ensure their SQL scripts get rewritten to ensure the database is built out properly. It seems possible to use psql variables to possibly achieve this but it seems like it would probably need to be done with some sort of shell script.

@payneBrandon
Copy link
Collaborator

ted is great because it does support the customization of the pg schema but I think it is a little too free form to expect the implementer to ensure their SQL scripts get rewritten t

Different DOTs (WYDOT in this case) will have requirements to deploy this system within an existing pg schema. If we have a better way of doing that we can definitely dive into it?

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.

4 participants