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

liquibase ignores envers tables postfix from org.liquibase.ext:liquibase-hibernate5:4.12.0 #460

Open
anothergoodguy opened this issue Feb 18, 2023 · 6 comments

Comments

@anothergoodguy
Copy link

anothergoodguy commented Feb 18, 2023

Hi,

We are using liquibase gradle plugin and the audit table generration with custom postfix _version is working fine till liquibase-hibernate5:4.11.0, but it is using the default _aud from liquibase-hibernate5:4.12.0.
The command we are using to generate the changelog is ./gradlew liquibaseDiffChangelog -PrunList=diffLog -Dorg.hibernate.envers.audit_table_suffix=_version -Dliquibase.diffTypes=data.
Please advise if the generation parameters are wrong or if the new version needs new params.

Please be informed that I have tried till liquibase-hibernate5:4.19.0 with gradual increase of versions with no success.

Thanks in advance...

@anothergoodguy
Copy link
Author

hi Team,

Any suggestions on this issue, please?

Thanks in advance...

@filipelautert
Copy link
Collaborator

Hi - there is an answer for a similar question in #99 (comment) .
Please reopen the issue if the problem still persists.

@anothergoodguy
Copy link
Author

anothergoodguy commented May 3, 2024

it still doesn't work even in liquibase-hibernate6 as well :(

my command is ./gradlew liquibaseDiffChangelog -PrunList=diffLog -Dorg.hibernate.envers.audit_table_suffix="_version" -Dhibernate.search.enabled=false -Dliquibase.diffTypes=data and my gradle config is

configurations {
    liquibaseRuntime.extendsFrom sourceSets.main.compileClasspath
}

dependencies {
  implementation "org.liquibase:liquibase-core"
  liquibaseRuntime "org.liquibase:liquibase-core"
  // Dependency required to parse options. Refer to https://github.com/liquibase/liquibase-gradle-plugin/tree/Release_2.2.0#news.
  liquibaseRuntime "info.picocli:picocli:4.7.5"
  liquibaseRuntime "com.mysql:mysql-connector-j"
  liquibaseRuntime "org.liquibase.ext:liquibase-hibernate6:${dependencyManagement.importedProperties['liquibase.version']}"
  // jhipster-needle-gradle-dependency - JHipster will add additional dependencies here
}

project.ext.diffChangelogFile = "src/main/resources/config/liquibase/changelog/" + new Date().format("yyyyMMddHHmmss") + "_changelog.xml"
if (!project.hasProperty("runList")) {
 project.ext.runList = "main"
}

liquibase {
  activities {
    main {
      driver "com.mysql.cj.jdbc.Driver"
      url "jdbc:mysql://<host>:<port>/my-db?useUnicode=true&characterEncoding=utf8&allowPublicKeyRetrieval=true&useSSL=false&useLegacyDatetimeCode=false&serverTimezone=UTC&createDatabaseIfNotExist=true"
      username "troot"
      password "*****"
      changeLogFile "src/main/resources/config/liquibase/master.xml"
      referenceUrl "hibernate:spring:com.myapp.platform.domain?dialect=org.hibernate.dialect.MySQL8Dialect&hibernate.physical_naming_strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy"
      defaultSchemaName "my-db"
      logLevel "debug"
      classpath "src/main/resources/"
    }
    diffLog {
      driver "com.mysql.cj.jdbc.Driver"
      url "jdbc:mysql://<host>:<port>/my-db?useUnicode=true&characterEncoding=utf8&allowPublicKeyRetrieval=true&useSSL=false&useLegacyDatetimeCode=false&serverTimezone=UTC&createDatabaseIfNotExist=true"
      username "troot"
      password "*****"
      changeLogFile project.ext.diffChangelogFile
      referenceUrl "hibernate:spring:com.myapp.platform.domain?dialect=org.hibernate.dialect.MySQL8Dialect&hibernate.physical_naming_strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy"
      defaultSchemaName "my-db"
      logLevel "debug"
      classpath "$buildDir/classes/java/main"
      excludeObjects "oauth_access_token, oauth_approvals, oauth_client_details, oauth_client_token, oauth_code, oauth_refresh_token"
    }
  }

  runList = project.ext.runList
}

liquibaseDiff.dependsOn compileJava
liquibaseDiffChangelog.dependsOn compileJava

ext {
  if (project.hasProperty("no-liquibase")) {
    springProfiles += ",no-liquibase"
  }
}

@anothergoodguy
Copy link
Author

not sure, why but I cant see an option to reopen this issue

@filipelautert filipelautert reopened this May 3, 2024
@anothergoodguy
Copy link
Author

no difference observed on this context for both these commands:

  1. ./gradlew liquibaseDiffChangelog -PrunList=diffLog -Dorg.hibernate.envers.audit_table_suffix="_version" -Dhibernate.search.enabled=false -Dliquibase.diffTypes=data
  2. ./gradlew liquibaseDiffChangelog -PrunList=diffLog -Dorg.hibernate.envers.audit_table_suffix="_version" -Dhibernate.search.enabled=false -Dliquibase.diffTypes=data -Dorg.hibernate.envers.global_with_modified_flag=true

@gdenchev
Copy link

gdenchev commented Aug 6, 2024

Had the same problem today.

Looked at the source code:
https://github.com/search?q=repo%3Aliquibase%2Fliquibase-hibernate%20AUDIT_TABLE_SUFFIX&type=code

Saw that the code searches for the audit table suffix setting in the connection URL.

Tried with the following in my liquibase.properties:
referenceUrl=hibernate:spring:[your_model_package]?dialect=org.hibernate.dialect.PostgreSQLDialect&org.hibernate.envers.audit_table_suffix=_aud

Seemed to work for me, please have a try and hopefully it will work for you :)

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

No branches or pull requests

3 participants