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

[V4.25.0] Diff changelog command fails without error when indexed column not existing #5346

Open
1 of 2 tasks
amazing4u opened this issue Dec 9, 2023 · 8 comments
Open
1 of 2 tasks

Comments

@amazing4u
Copy link

Search first

  • I searched and no similar issues were found

Description

Hi,

i want to inform you about a bug, which i found in version 4.25.0 (older versions also affected) and hibernate6:

If you have a Entity and index a column which does not exist (or you typed it wrong) the diff changelog fails without error.

The diff will not be created, but you don't know why. Please throw a exception with a meaningful error message for this error, so the users do not have to search for the problem as long as i had to :slight_smile:

Steps To Reproduce

You can reproduce it with this example

@Entity
@Table(name = "users", indexes = {
        @Index(name = "username_index", columnList = "NOTEXISTINGCOLUMN"),
})
public class UserEntity { ... }
[INFO] Diff command completed
[INFO] BEST PRACTICE: The changelog generated by diffChangeLog/generateChangeLog should be inspected for correctness and completeness before being deployed. Some database objects and their dependencies cannot be represented automatically, and they may need to be manually updated before being deployed.
[WARNING] Diff changelog command failed
[INFO] Command execution complete
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

Expected/Desired Behavior

Generation fails with a meaningful error message

Liquibase Version

4.25

Database Vendor & Version

PostgreSQL 15

Liquibase Integration

maven

Liquibase Extensions

liquibase-maven-plugin

OS and/or Infrastructure Type/Provider

Windows 11

Additional Context

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR (Thank you!)
@tati-qalified
Copy link
Contributor

Hi @amazing4u, thank you for reporting this issue. I have been able to replicate it and I agree that the error message should contain more information.

I'll be forwarding this to the development team so they can evaluate how to move forward.

Thank you,
Tatiana

@samuelm00
Copy link

samuelm00 commented Apr 21, 2024

Not sure if this is related but I ran into a similar problem here when trying to create a many to many relationship between two tables: liquibase/liquibase-gradle-plugin#143

@tati-qalified
Copy link
Contributor

Hi @amazing4u and @samuelm00. The error message problem is fixed with #5828 - could you use the artifacts from that PR to show what the error is? Let us know if you need further help after that.

Thank you,
Tatiana

@samuelm00
Copy link

@tati-qalified This issues is probably related as well:

class A {
  @Id
  private Long id;

  @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(
        name = "a",
        joinColumns = @JoinColumn(name = "b_id"),
        inverseJoinColumns = @JoinColumn(name = "a_id"))
    private Set<B> bs;
}

class B {
  @Id
  private Long id;

  @ManyToMany(mappedBy = A_.BS, fetch = FetchType.LAZY)
  private Set<A> as;
}

If the @JoinTable(name) is equal to an existing table, liquibase executed the diffChangelog command successfully but didn't generate any files.

But when you run the command with --debug you can see the following message:
WARNING [liquibase.command] Diff changelog command failed

@tati-qalified
Copy link
Contributor

@samuelm00 a fix to this was merged to master last week.
Could you use this updated version to re-test and let us know if the error message contains more information?

@amazing4u
Copy link
Author

@tati-qalified How can we try the latest master when there is no new release yet? Is there some snapshot version we can use?

@tati-qalified
Copy link
Contributor

@amazing4u
You can download it from here: https://github.com/liquibase/liquibase/actions/runs/8930022026/artifacts/1468641178 or obtain it using GPM (gradle or maven ):

<dependency>
 <groupId>org.liquibase</groupId>
 <artifactId>liquibase-core</artifactId>
 <version>master-SNAPSHOT</version>
</dependency>
api("org.liquibase:liquibase-core:master-SNAPSHOT")

@amazing4u
Copy link
Author

@amazing4u You can download it from here: https://github.com/liquibase/liquibase/actions/runs/8930022026/artifacts/1468641178 or obtain it using GPM (gradle or maven ):

<dependency>
 <groupId>org.liquibase</groupId>
 <artifactId>liquibase-core</artifactId>
 <version>master-SNAPSHOT</version>
</dependency>
api("org.liquibase:liquibase-core:master-SNAPSHOT")

Sorry, i was not able to use/install the provided snapshot version.

Tried with maven, but the snapshot versions are not in maven central repository.
Could not resolve dependencies for project XYZ: org.liquibase:liquibase-core:jar:master-SNAPSHOT was not found in https://repo.maven.apache.org/maven2/ during a previous attempt

Also tried to install the library manually using mvn install:install-file on the liquibase-core.jar but this also failed ;/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Open Issues
Development

No branches or pull requests

4 participants