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

Optimise the logic for tableIsEmpty check constraint #4834

Merged
merged 4 commits into from Sep 19, 2023

Conversation

filipelautert
Copy link
Collaborator

Impact

  • Bug fix (non-breaking change which fixes expected existing functionality)
  • Enhancement/New feature (adds functionality without impacting existing logic)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Optimise the logic for verifying if a table is empty: instead of selecting count the table, uses exists.

Things to be aware of

SQL Ansi for all databases query.

Things to worry about

NA

Additional Context

Added tests. Fixes #4734

@filipelautert filipelautert self-assigned this Sep 4, 2023
@filipelautert filipelautert marked this pull request as ready for review September 4, 2023 20:17
@filipelautert filipelautert changed the title Implements a better check for TableIsEmpty using SQL ansi + tests Optimise the logic for check constraint table is empty Sep 4, 2023
@filipelautert filipelautert changed the title Optimise the logic for check constraint table is empty Optimise the logic for tableIsEmpty check constraint Sep 5, 2023
Copy link
Contributor

@rberezen rberezen left a comment

Choose a reason for hiding this comment

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

@rberezen
Copy link
Contributor

rberezen commented Sep 8, 2023

Fix for the test failure https://github.com/liquibase/liquibase-pro-tests/pull/969

@tati-qalified
Copy link
Contributor

@rberezen the precondition is working as expected with an xml format changelog. I wasn't able to find how to implement the precondition for other formats, if it's even supported, so I didn't test those cases.

@filipelautert filipelautert force-pushed the improve-table-is-empty-precondition branch from 23a5ed4 to b9bae56 Compare September 13, 2023 02:15
@filipelautert filipelautert merged commit f07c621 into master Sep 19, 2023
29 of 30 checks passed
@filipelautert filipelautert deleted the improve-table-is-empty-precondition branch September 19, 2023 12:12
@filipelautert filipelautert added this to the 1NEXT milestone Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Optimise the logic for verifying if a table is empty
4 participants