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

Add support for AS <dataType> clause for H2 since version 2.0 #3047

Merged
merged 4 commits into from
Aug 9, 2022

Conversation

marcus-nl
Copy link
Contributor

@marcus-nl marcus-nl commented Jul 7, 2022

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

Currently Liquibase explicitly excludes H2 when emitting the AS <dataType> clause. However, H2 has support for this feature since version 2.0. This effect of this change is that the CreateSequenceGenerator will only omit the clause for versions before that.

Things to be aware of

I also extended the existing unit test to verify the new behavior. In the process I also attempted to improve the code
for better readability and consistency. For example, I used the generatorUnderTest field instead of creating a new CreateSequenceGenerator instance.

This also fixes the issue of an unsupported "dataType" on old h2 versions being ignored instead of failing validation like it should have. This will impact on old versions of h2 using dataType as an attribute.

Things to worry about

n/a

Additional Context

n/a

@kataggart kataggart added this to To Do in Conditioning++ via automation Jul 7, 2022
@nvoxland nvoxland self-requested a review as a code owner July 27, 2022 16:19
@nvoxland nvoxland added the SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions label Jul 27, 2022
@github-actions
Copy link

github-actions bot commented Jul 27, 2022

Unit Test Results

  4 620 files  ±0    4 620 suites  ±0   33m 41s ⏱️ - 2m 38s
  4 606 tests ±0    4 391 ✔️ ±0     215 💤 ±0  0 ±0 
54 444 runs  ±0  49 424 ✔️ ±0  5 020 💤 ±0  0 ±0 

Results for commit c414c6c. ± Comparison against base commit 6ad7472.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@nvoxland nvoxland left a comment

Choose a reason for hiding this comment

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

Code review and test results:

Things to be aware of:

  • change is isolated to H2 and makes sense to me
  • includes a mock connection test
  • failing functional test is unrelated to this change

@nvoxland nvoxland changed the base branch from master to 1_9 July 28, 2022 21:26
@nvoxland nvoxland changed the base branch from 1_9 to master July 28, 2022 21:27
@nvoxland
Copy link
Contributor

On further review, while you were preserving the old "just ignore the unsupported dataType" logic from before, we are working to make any unsupported attributes be validation errors so it isn't surprising when requested changelog settings aren't applied. I also moved the similar postgresql check to the same area of the code, and added an integration test entry that uses the attribute to validate that the generated SQL is correct.

I pushed the changes up to your branch and updated my review notes above.

@nvoxland nvoxland added SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions and removed SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions labels Jul 28, 2022
…ngs to validation errors on old h2 and postgresql
@nvoxland nvoxland added SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions and removed SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions labels Jul 28, 2022
Copy link
Contributor

@XDelphiGrl XDelphiGrl left a comment

Choose a reason for hiding this comment

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

  • Fix adds support for sql generation of the "AS" clause for H2 versions 2.0 or later.
    • If H2 is less than 2.0, a validation error is returned by Liquibase.
    • If H2 is 2.0 or greater, generated SQL includes AS clause, i.e., CREATE SEQUENCE SCHEMA_NAME.SEQUENCE_NAME AS BIGINT.
  • New tests added validating behavior for H2 versions older than 2.0 and equal to 2.0.
  • Passing test harness execution; functional tests N/A.

APPROVED

@nvoxland nvoxland merged commit c1b1f92 into liquibase:master Aug 9, 2022
Conditioning++ automation moved this from To Do to Done Aug 9, 2022
@kataggart kataggart added this to the NEXT milestone Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autocandidate DBH2 SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions sprint2022-31 TypeEnhancement
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants