department-of-veterans-affairs / notification-api

Notification API
MIT License
16 stars 9 forks source link

PORTAL-2480 - creates migration to add expected_cadence to promoted_templates #2121

Closed MarchandMD closed 1 week ago

MarchandMD commented 1 week ago

Description

Adds the expected_cadence text field to the promoted_templates table

issue 2480 of the notification-portal

How Has This Been Tested?

ran flask db upgrade and then flask db downgrade locally

deploy to dev - api action run successful - verifies migration run successfully DB downgrade action run successful - verifies migration rollback successful

Checklist

ianperera commented 1 week ago

Looks good so far,

  1. What do you think about adding an Index for it?
  2. Making it enum type instead of text?
MarchandMD commented 1 week ago
  1. I don't believe the promoted_templates table will be queried frequently enough to necessitate this index, though I'd listen to arguments in favor of one
  2. Considering the values will be similar to: daily, weekly, monthly, etc, I feel like integers wouldn't be appropriate.

@ianperera

ianperera commented 1 week ago
  1. I don't believe the promoted_templates table will be queried frequently enough to necessitate this index, though I'd listen to arguments in favor of one
  2. Considering the values will be similar to: daily, weekly, monthly, etc, I feel like integers wouldn't be appropriate.

@ianperera

typo, I meant enum.

MarchandMD commented 1 week ago

Enum would be an unnecessary obfuscation, IMO. The idea of an "expected cadence" is already somewhat opaque, and considering all the potential values (daily, weekly, monthly, quarterly, one-time, adhoc, etc) the most informative and simplest way to store this information for each record is it's actual text value, as opposed to a representation of its value. The reason being, if an expected cadence for a single record is needed, we as engineers would be able to observe a single record and determine its expected cadence without needing to reference the base model to decipher its value from an enum key. IMO.

cris-oddball commented 1 week ago

@MarchandMD before you ask for more approvals, please update the title to follow this convention (necessary for the release notes): PORTAL-2480 - blah blah

Also, this needs to be deployed to Dev to be able to merge (please use the branch name for both the 'workflow' and the 'branch name' in the action, so that the deploy properly links back to this PR) and then run the DB downgrade action, and both of those runs linked in your testing notes. Happy to help if that's unclear. Thank you!

ianperera commented 1 week ago

Enum would be an unnecessary obfuscation, IMO. The idea of an "expected cadence" is already somewhat opaque, and considering all the potential values (daily, weekly, monthly, quarterly, one-time, adhoc, etc) the most informative and simplest way to store this information for each record is it's actual text value, as opposed to a representation of its value. The reason being, if an expected cadence for a single record is needed, we as engineers would be able to observe a single record and determine its expected cadence without needing to reference the base model to decipher its value from an enum key. IMO.

as engineers, if we document the enum values clearly, it would be easy to understand.

MarchandMD commented 1 week ago

@cris-oddball With the help of you and Evan I was able to successfully perform both actions.

The PR description has been updated with links to both of those runs.

Please LMK if there's anything else I can do to expedite this PR! Thank you!

cris-oddball commented 1 week ago

@MarchandMD thank you! If you want the llamas to review, you'll need to ask for that review. I think both Ian and Nathan are in our engineering channel and they can ask for you - see what they say?