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

Different amend approaches: in-place versioning vs changelog table #1208

Open
sldblog opened this issue Sep 27, 2022 · 0 comments
Open

Different amend approaches: in-place versioning vs changelog table #1208

sldblog opened this issue Sep 27, 2022 · 0 comments

Comments

@sldblog
Copy link
Contributor

sldblog commented Sep 27, 2022

Short problem statement; why is this a problem?

We have two approaches for tracking the "amend a referral" functionality.

Both approaches require us to retain the previous values for auditability to users and reporting.

  1. First came the in-place versioning
  2. Then we rolled out changelog and used in-place updating

Link to different approaches

  1. Code using in-place versioning:

referralDetailsRepository.saveAndFlush(newDetails)
if (existingDetails !== null && existingDetails !== newDetails) {
existingDetails.supersededById = newDetails.id
referralDetailsRepository.saveAndFlush(existingDetails)

  1. Code using in-place updates:

referral.complexityLevelIds?.put(serviceCategoryId, update.complexityLevelId)
val oldValue = ReferralAmendmentDetails(listOf(complexityLevel!!.toString()))
val newValue = ReferralAmendmentDetails(listOf(update.complexityLevelId.toString()))

Do you have a proposed solution? Why?

Migrate everything to the changelog approach.

➕ Benefits: simplifies code and data model
➖ Drawbacks: bit complex to roll out in a zero-downtime environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant