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

Do not write output files for computed columns when executing dbDoc. Fixes #1088 #3398

Merged
merged 5 commits into from
Nov 16, 2022

Conversation

rozenshteyn
Copy link
Contributor

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

A clear and concise description of the change being made.

Fix dbDoc fails to generate documents for an Oracle database when an index is created using a filter clause. Fixes #1088.
Skip writing an html file for Oracle database columns which have the computed flag set (i.e. the column was created based on the content of the filter clause of an index).

Things to be aware of

  • I constrained the code change to only apply to the Oracle database. I'm not sure if other database types could have the same issue whereupon the column name is set to the content of the index filter clause in the
    returnIndex.getColumns().set(position - 1, new Column()
    .setRelation(returnIndex.getRelation()).setName(definition, true));
  • Since I was not sure how to properly mock a static method in groovy/spock, I created DBDocVisitorTest.java.

Things to worry about

  • None at this time.

Additional Context

None at this time.

@filipelautert filipelautert self-assigned this Nov 8, 2022
@filipelautert filipelautert self-requested a review November 8, 2022 18:58
@filipelautert filipelautert added SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions sprint2022-37 and removed SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions labels Nov 8, 2022
@github-actions
Copy link

github-actions bot commented Nov 8, 2022

Unit Test Results

  4 752 files  +12    4 752 suites  +12   31m 33s ⏱️ - 3m 3s
  4 695 tests  - 16    4 459 ✔️  - 19     236 💤 +3  0 ±0 
55 560 runs  +12  50 252 ✔️ +  7  5 308 💤 +5  0 ±0 

Results for commit d5c03ff. ± Comparison against base commit fe07fae.

♻️ This comment has been updated with latest results.

@filipelautert
Copy link
Collaborator

Hi @rozenshteyn ! Thanks for the PR.
I ran the same test case from the issue on Postgres and had the same problem, so you were right that it's not just an Oracle problem. But I tried a different approach: I used the original class but changed the SnapshotControl to just bring Table and Columns as below (DBDocVisitor line 129), and it worked on Postgres (index wasn't listed as column):

        DatabaseSnapshot snapshot = SnapshotGeneratorFactory.getInstance().createSnapshot(
                database.getDefaultSchema(), database, new SnapshotControl(database, Table.class, Column.class));

Could you help test it on Oracle? So maybe this would be a simpler approach to fix this?

@rozenshteyn
Copy link
Contributor Author

rozenshteyn commented Nov 11, 2022

@filipelautert I tested your proposed fix with the Oracle db. While it does resolve the issue of failing to write out db documentation, it creates a new issue whereupon the index info is missing in the produced db documentation. Since you've mentioned that original issue affects not just the Oracle db, I went ahead and modified my fix by removing the restriction that it applies to the Oracle db only.

@filipelautert filipelautert added SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions sprint2022-38 and removed SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions labels Nov 11, 2022
@filipelautert
Copy link
Collaborator

@rozenshteyn thanks for testing out my approach! So all seems good, moving along. Thanks for the fix.

@filipelautert filipelautert 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 needs_response DBOracle labels Nov 11, 2022
Copy link
Collaborator

@filipelautert filipelautert left a comment

Choose a reason for hiding this comment

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

Working fine, also adds tests.

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.

This PR addresses a bug in the generation of database documentation where empty HTML files were created for Oracle computed columns.

APPROVED

@filipelautert filipelautert changed the title Do not write output files for computed columns in Oracle database. Fixes #1088 Do not write output files for computed columns when executing dbDoc. Fixes #1088 Nov 16, 2022
@filipelautert filipelautert removed the SafeToBuild Indicates that a particular PR contains changes which are safe to build using GitHub actions label Nov 16, 2022
@filipelautert filipelautert merged commit 0a4de08 into liquibase:master Nov 16, 2022
@filipelautert filipelautert added this to the 4.18.0 milestone Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Liquibase-core - dbDoc fails generating of documents
6 participants