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

diffChangeLog incomplete alter hibernate sequence table on generated changelog #97

Open
marchicman opened this issue Dec 27, 2021 · 0 comments

Comments

@marchicman
Copy link

I'm not sure if it's a matter of gradle plugin or liquibase hibernate plugin I use to get the differences between my entity classes and DB but when I run diffChangeLog on existing database with no differences after creating it I got an incomplete and wrong yaml file

databaseChangeLog:

  • changeSet:
    id: 1640603860862-1
    author: manlio.marchica (generated)
    changes:
    • alterSequence:
      sequenceName: hibernate_sequence

This is the command:

gradle diffChangeLog -PchangeLogFile=liquibase-changeLog.yml

I use Gradle 6.8.3 and this is my build.gradle:

plugins {
	id 'org.springframework.boot' version '2.5.4'
	id 'io.spring.dependency-management' version '1.0.11.RELEASE'
	id 'java'
	id "io.freefair.lombok" version "5.3.0"
	id 'com.google.cloud.tools.jib' version '3.1.2'
	id 'org.liquibase.gradle' version '2.1.1'
}

group = 'it.euei'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

configurations {
	compileOnly {
		extendsFrom annotationProcessor
	}		
}

repositories {
	mavenCentral()
}

ext['log4j2.version'] = '2.17.0'


dependencies {
	implementation      'org.springframework.boot:spring-boot-starter-data-jpa'
	implementation      'org.springframework.boot:spring-boot-starter-security'
	implementation      'org.springframework.boot:spring-boot-starter-web'
	implementation      'org.liquibase:liquibase-core:4.6.2'
	compileOnly         'org.projectlombok:lombok'
	implementation	    'org.apache.poi:poi:5.0.0'
	implementation 		group: 'org.apache.commons', name: 'commons-vfs2', version: '2.9.0'
	implementation 		group: 'com.jcraft', name: 'jsch', version: '0.1.55'
	implementation 		group: 'commons-net', name: 'commons-net', version: '3.8.0'	
	implementation 		group: 'org.apache.commons', name: 'commons-collections4', version: '4.4'	
	implementation      group: 'com.github.ulisesbocchio', name: 'jasypt-spring-boot-starter', version: '2.1.2'	
	runtimeOnly         'org.postgresql:postgresql'
	annotationProcessor 'org.projectlombok:lombok'
	testImplementation  'org.springframework.boot:spring-boot-starter-test'
	testImplementation  'org.springframework.security:spring-security-test'

	implementation 'org.apache.commons:commons-lang3'
	implementation("com.google.guava:guava:30.1.1-jre")
	implementation group: 'commons-io', name: 'commons-io', version: '2.11.0'
	implementation group: 'commons-codec', name: 'commons-codec' 

	implementation group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1'
	
	liquibaseRuntime 'org.liquibase:liquibase-core:4.6.2'
  	liquibaseRuntime 'org.liquibase:liquibase-groovy-dsl:3.0.2'
  	liquibaseRuntime 'org.liquibase.ext:liquibase-hibernate5:4.6.2'
  	liquibaseRuntime 'org.yaml:snakeyaml:1.30'
  	liquibaseRuntime 'info.picocli:picocli:4.6.2'
  	liquibaseRuntime "org.postgresql:postgresql:42.2.23"
  	// Adding sourceSets.main.output is necessary for Hibernate to find your entity classes.
    liquibaseRuntime sourceSets.main.output    
    liquibaseRuntime sourceSets.main.runtimeClasspath
}

test {
	useJUnitPlatform()
}

if (project.hasProperty("tag")) {
    ext.tg = project.getProperty("tag")
} else { 
    ext.tg = "dev"
}

if (project.hasProperty("changeLogFile")) {
    ext.changeLogFile = project.getProperty("changeLogFile")
} else { 
    ext.changeLogFile = "db.changelog-master.yaml"
}

jib {

  from { 
  	image = 'adoptopenjdk/openjdk11:jdk-11.0.12_7-ubuntu' 
  } 

  to {
    image = "eueiacrprod.azurecr.io/cribis-client-be:${tg}"
  }
  container {
    jvmFlags = ['-Xdebug','-Duser.timezone=Europe/Rome']
    mainClass = 'it.euei.cribis.client.Application'
  }
}

liquibase {
  activities {
	main {
      changeLogFile 'src/main/resources/db/changelog/' + project.ext.changeLogFile
      url 'jdbc:postgresql://localhost:5002/cribis'
      defaultSchemaName 'public'
      username 'cribis'
      password 'cribis'
      referenceDriver 'liquibase.ext.hibernate.database.connection.HibernateDriver'
	  referenceUrl "hibernate:spring:it.euei.cribis.client.model?dialect=org.hibernate.dialect.PostgreSQL10Dialect&hibernate.enhanced_id=true&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy"	  
    }            
  }  
}

diffChangeLog.dependsOn compileJava
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

1 participant