Git Product home page Git Product logo

Comments (9)

stevesaliman avatar stevesaliman commented on August 29, 2024 1

I have some good news and some bad news....

The good news is that I've found the source of the bug.

The bad news is that the bug is in Liquibase itself - the diffChangeLog command only supports XML changelogs.

I created CORE-3343 in the Liquibase Jira system to track this problem. There is also an explanation of why this is happening in the Jira.

If you aren't editing changelogs by hand, then the format is less important and you could switch to XML changelogs as a workaround. XML changelogs don't appear to have this problem.

from liquibase-gradle-plugin.

stevesaliman avatar stevesaliman commented on August 29, 2024

I'm not sure what might be going on. I just tried running gradlew diffChangeLog on one of my projects and it generated a changelog that was over 5,000 lines long without any syntax problems on a Linux system.

My project is not a Spring Boot application, and my urls were standard jdbc urls. Are you using the Liquibase Spring Boot plugin? What do your URLs look like?

from liquibase-gradle-plugin.

nelson687se avatar nelson687se commented on August 29, 2024

This is my build.gradle file. There is not liquibase spring boot plugin, as springboot comes with liquibase built in.

	ext {
		springBootVersion = '2.0.5.RELEASE'
	}
	repositories {
		mavenCentral()
	}
	dependencies {
		classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
		classpath 'org.liquibase.ext:liquibase-hibernate5:3.6'
	}
}

plugins {
    id 'java'
    id 'eclipse'
    id 'org.springframework.boot' version '2.0.5.RELEASE'
    id 'io.spring.dependency-management' version '1.0.6.RELEASE'
	id 'org.liquibase.gradle' version '2.0.1'
}

group = 'com.flashsales.flights'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
	mavenCentral()
}

dependencies {
	compileOnly('org.projectlombok:lombok:1.16.20')
	compile('org.springframework.boot:spring-boot-starter-web')
	compile ("org.springframework.boot:spring-boot-starter-data-jpa")
	compile ('mysql:mysql-connector-java')
	compile('org.liquibase:liquibase-core')
	compile('org.liquibase:liquibase-groovy-dsl:2.0.1')
	runtime('org.springframework.boot:spring-boot-devtools')
	testImplementation('org.springframework.boot:spring-boot-starter-test')
	testCompile(group:'net.bytebuddy', name:'byte-buddy', version:'1.8.22')
	liquibaseRuntime 'org.liquibase:liquibase-core'
	liquibaseRuntime 'org.liquibase:liquibase-groovy-dsl:2.0.1'
	liquibaseRuntime 'mysql:mysql-connector-java'
	liquibaseRuntime 'org.springframework.boot:spring-boot-starter-data-jpa'
	liquibaseRuntime 'org.springframework.boot:spring-boot-starter-web'
	liquibaseRuntime 'org.liquibase.ext:liquibase-hibernate5:3.6'
	liquibaseRuntime sourceSets.main.output
}

liquibase {
  activities {
    main {
      changeLogFile 'src/main/resources/db/changelog/changelog.groovy'
      url 'jdbc:mysql://localhost:3306/fsb?autoReconnect=true'
	  referenceUrl 'hibernate:spring:com.company.domain?dialect=org.hibernate.dialect.MySQLDialect'
      username 'root'
      password ''
    }
  }
}

What I do is:
I first run: ./gradlew generateChangelog - Then ./gradlew diffChangeLog and everything is fine. I run the app, and it creates the database changes. After that, I make a change in a domain class (deleting or adding a property), and want to generate the changeset for that change so I run again ./gradlew diffChangeLog and this is when the changelog.groovy gets messed up.

from liquibase-gradle-plugin.

stevesaliman avatar stevesaliman commented on August 29, 2024

My guess is that the hibernate plugin might be interfering somehow. Do you have a sample project that shows the problem that I could use to debug how the plugin reacts?

from liquibase-gradle-plugin.

nelson687se avatar nelson687se commented on August 29, 2024

Sure, I've uploaded this: https://github.com/nelson687/springboot-liquibase - I ran ./gradlew generateChangelog and got the empty changelog, then I ran ./gradlew diffChangeLog against an empty database and got the changelog populated. After this, I run the app, and I get the database structure created, now, if I remove a property from TestTable and run ./gradlew diffChangeLog again, this is when I get the issues in the file

from liquibase-gradle-plugin.

stevesaliman avatar stevesaliman commented on August 29, 2024

A can now reproduce the problem, but I'm not sure what could be causing it. I'm pretty sure the error is in the Liquiabse Groovy DSL. I'll keep working on it.

from liquibase-gradle-plugin.

nelson687se avatar nelson687se commented on August 29, 2024

I tried without the Liquibase Groovy DSL and it's also happening the same.
Is there no workaround for this then? The only option is to write the changesets manually?

from liquibase-gradle-plugin.

stevesaliman avatar stevesaliman commented on August 29, 2024

I seem to remember trying it without the DSL and having it do the right thing. I'll have to try it again to be sure.

I would be a bit surprised if the issue did wind up being a plugin issue since the plugin is just a thin wrapper around the main Liquibase method.

At the moment, the only workaround I can think of is to re-run generateChangeLog to recreate the changelog from scratch. However, if it changes the ids of the changesets, that won't help much.

I will work on a fix for this issue as soon as I can. Next weekend is out for me, but I should be able to work on it the following weekend.

from liquibase-gradle-plugin.

stevesaliman avatar stevesaliman commented on August 29, 2024

Closing due to inactivity. This can't be fixed without resolving the underlying Liquibase issue, and there hasn't been any movement on that issue in 5 years.

from liquibase-gradle-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.