liquibase / liquibase-gradle-plugin

A Gradle plugin for Liquibase
Other
197 stars 57 forks source link

diffChangeLog ignores @SecondaryTable annotation #83

Closed HighKo closed 3 years ago

HighKo commented 3 years ago

Greetings, I stumbled over this issue.

Preconditions: I have 2 entities managed by Hibernate as shown below. In my Database I have a Table for each. I can save/load the TextBlock entity from the PostgreSQL Database using hibernate. It correctly merges both tables into my single TextBlock entity.

Actual Outcome: Running grade diffChangeLog generates a changelog.sql containing: DROP TABLE block_text;.

Expected Outcome: The changelog should be empty.

@Entity
@Table(name = "BLOCK")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "TYPE")
public class Block
@Entity
@DiscriminatorValue("TextBlock")
@SecondaryTable(name = "BLOCK_TEXT")
public class TextBlock extends Block

Others appear to have the same issue: https://stackoverflow.com/questions/60967657/liquibase-diff-does-not-work-for-secondarytable https://coderanch.com/t/512070/databases/Hibernate-SecondaryTable-annotation

stevesaliman commented 3 years ago

The poster of the stackoverflow issue you mentioned appears to be using Maven, which makes me strongly suspect that the underlying problem is in Liquibase itself, and not the Gradle plugin. I'd suggest creating an issue in the Liquibase repo.

If there is something you think that the plugin is doing that is causing Liquibase to misbehave, we can re-open this issue and I can look into it further.