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

Fix isNewLicence null violation for prev. trans. #243

Merged
merged 3 commits into from
May 25, 2023

Conversation

Cruikshanks
Copy link
Member

We had an issue reported that we were able to replicate locally. It looks like when we try to persist billing_transactions 'en masse' using Objection.js it behaves slightly differently than when inserting them in one by one.

In our latest changes, where we now wait till we have generated all the transactions for a billing period before persisting them a new issue has come to light.

...
null value in column \"is_new_licence\" of relation \"billing_transactions\" violates not-null constraint"
...

After some debugging, we found that our generated transactions were ok. It was any previous transactions we had fetched and were trying to persist as credits. We weren't fetching isNewLicence because we were depending on it defaults to false. It seems we must now fetch the property and ensure it is in the object when trying to persist them en masse.

We had an issue reported that we were able to replicate locally. It looks like when we try to persist `billing_transactions` 'en masse' using Objection.js it behaves slightly differently than when inserting them in one by one.

With our latest changes to to wait till we have generated _all_ the transactions for a billing period before persisting a new issue has come to light.

```
...
null value in column \"is_new_licence\" of relation \"billing_transactions\" violates not-null constraint"
...
```

After some debugging we found that our generated transactions wre ok. It was any previous transactions we had fetched and were trying to persist as credits. We weren't fetching `isNewLicence` because we were depending on it defaulting to false. It seems we must now fetch the property and ensure it is in the object when trying to persist them en masse.
@Cruikshanks Cruikshanks added the bug Something isn't working label May 25, 2023
@Cruikshanks Cruikshanks self-assigned this May 25, 2023
@Cruikshanks Cruikshanks marked this pull request as ready for review May 25, 2023 12:02
Copy link
Contributor

@Jozzey Jozzey left a comment

Choose a reason for hiding this comment

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

👍🏼

@Cruikshanks Cruikshanks merged commit a4a5a86 into main May 25, 2023
@Cruikshanks Cruikshanks deleted the fix-is-new-licence-null-violation branch May 25, 2023 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants