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

PS-1956: cast EF Min function values to int #2459

Merged
merged 1 commit into from
Dec 2, 2022
Merged

Conversation

kspearrin
Copy link
Member

Resolves https://bitwarden.atlassian.net/browse/PS-1956
Resolves https://bitwarden.atlassian.net/browse/PS-1958
Resolves https://bitwarden.atlassian.net/browse/PS-1959

Type of change

- [x] Bug fix
- [ ] New feature development
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

Postgres does not allow the MIN aggregate function with boolean data types. This change casts the boolean to an int and then back out to a boolean after the MIN function aggregates the expected result from 0 and 1 values.

Code changes

  • CollectionRepository.cs: Convert bool values to int for the Min function and back out to bool again.
  • 2022-03-01_00_Up_MigrateOrganizationApiKeys.psql: gen_random_uuid() is not available in postgres versions <13 without loading extensions. This causes migrations to fail. Switch to something more compatible to generate random UUID values. This shouldn't matter anyways since Postgres is net new and there is no data to migrate for people here.
  • 2022-03-25_00_SelfHostF4E.psql: gen_random_uuid() is not available in postgres versions <13 without loading extensions. This causes migrations to fail. Switch to something more compatible to generate random UUID values. This shouldn't matter anyways since Postgres is net new and there is no data to migrate for people here.

Before you submit

  • Please check for formatting errors (dotnet format --verify-no-changes) (required)
  • If making database changes - make sure you also update Entity Framework queries and/or migrations
  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team

@kspearrin kspearrin merged commit 41db511 into master Dec 2, 2022
@kspearrin kspearrin deleted the postgresfixes branch December 2, 2022 18:55
kspearrin added a commit that referenced this pull request Dec 2, 2022
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.

None yet

2 participants