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

MySQL Exists statement Support #1760

Merged
merged 5 commits into from
Sep 14, 2023

Conversation

aindriu-aiven
Copy link
Contributor

Remove custom exists queries and use jpql to have spring do queries based on the drivers which handle all details

About this change - What it does
Uses JPQL to handle exists requests and removes the native queries.
Resolves: #xxxxx
Why this way

…ased on the drivers which handle all details

Signed-off-by: Aindriu Lavelle <[email protected]>
Signed-off-by: Aindriu Lavelle <[email protected]>
boolean res = schemaRequestRepo.existsRecordsCountForTeamId(teamId, tenantId);
boolean res =
schemaRequestRepo.existsByTeamIdAndTenantIdAndRequestStatus(
teamId, tenantId, RequestStatus.CREATED.value);
Copy link
Contributor

Choose a reason for hiding this comment

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

adding request status parameter intentional ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it was hard coded in the native query for the requests it is checking if there is an open request for that team

@aindriu-aiven aindriu-aiven force-pushed the issue-mysql-support-remove-custom-exists branch from 6aea173 to 09dc24b Compare September 13, 2023 10:42
@aindriu-aiven aindriu-aiven marked this pull request as ready for review September 13, 2023 10:42
@@ -34,19 +34,11 @@ boolean existsSchemaRequestByEnvironmentAndTenantId(
boolean existsSchemaRequestByEnvironmentAndTenantIdAndRequestStatus(
Copy link
Contributor

Choose a reason for hiding this comment

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

not part of this change, but an unused method, can be deleted.

muralibasani
muralibasani previously approved these changes Sep 13, 2023
Copy link
Contributor

@muralibasani muralibasani left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

…he db to the app and vice versa

Signed-off-by: Aindriu Lavelle <[email protected]>
@aindriu-aiven
Copy link
Contributor Author

We found during testing that mysql was only saving datetime down to seconds, where h2 was down to the millisecond.

Copy link
Contributor

@muralibasani muralibasani left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@aindriu-aiven aindriu-aiven merged commit 6601187 into main Sep 14, 2023
@aindriu-aiven aindriu-aiven deleted the issue-mysql-support-remove-custom-exists branch September 14, 2023 12:06
aindriu-aiven added a commit that referenced this pull request Sep 14, 2023
* Remove custom exists queries and use jpql to have spring do queries based on the drivers which handle all details

Signed-off-by: Aindriu Lavelle <[email protected]>

* Run spotless:apply

Signed-off-by: Aindriu Lavelle <[email protected]>

* Update to recitfy exists statement that had a not clause in it.

Signed-off-by: Aindriu Lavelle <[email protected]>

* Use a converter to ensure that the data is converted correctly from the db to the app and vice versa

Signed-off-by: Aindriu Lavelle <[email protected]>

---------

Signed-off-by: Aindriu Lavelle <[email protected]>
aindriu-aiven added a commit that referenced this pull request Sep 14, 2023
* Remove custom exists queries and use jpql to have spring do queries based on the drivers which handle all details



* Run spotless:apply



* Update to recitfy exists statement that had a not clause in it.



* Use a converter to ensure that the data is converted correctly from the db to the app and vice versa



---------

Signed-off-by: Aindriu Lavelle <[email protected]>
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.

2 participants