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: Update entity constraint changelog producing wrong baseColumnName for ManyToMany relationships #26910

Closed
1 task done
OmarHawk opened this issue Aug 6, 2024 · 0 comments · Fixed by #26911
Closed
1 task done

Comments

@OmarHawk
Copy link
Contributor

OmarHawk commented Aug 6, 2024

Overview of the issue

When we added a new ManyToMany relationship to existing tables, the constraints being generated differ from when this is part of the initial generation - and it produces invalid constraints.

Just compare these two lines (they should be kind of equal, as it is the same thing that is being generated):
Correct (uses entity.entityTableName as part of the baseColumnNames):

<addForeignKeyConstraint baseColumnNames="<%= entity.primaryKey.fields.map(field => entity.entityTableName + '_' + field.columnName).join(', ') %>"

Wrong (uses relationship.columnName as part of the baseColumnNames)

<addForeignKeyConstraint baseColumnNames="<%= entity.primaryKey.fields.map(field => relationship.columnName + '_' + field.columnName).join(', ') %>"

Motivation for or Use Case

Saving doesn't work properly using that kind of constraint.

Reproduce the error
Related issues
Suggest a Fix

Align the two files. I'll prepare a PR.

JHipster Version(s)

8.6.0

JHipster configuration
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
  • Checking this box is mandatory (this is just to show you read everything)
@OmarHawk OmarHawk changed the title Liquibase: Update entity constraint changelog producing wrong baseColumnName Liquibase: Update entity constraint changelog producing wrong baseColumnName for ManyToMany relationship Aug 6, 2024
@OmarHawk OmarHawk changed the title Liquibase: Update entity constraint changelog producing wrong baseColumnName for ManyToMany relationship Liquibase: Update entity constraint changelog producing wrong baseColumnName for ManyToMany relationships Aug 6, 2024
OmarHawk added a commit to OmarHawk/generator-jhipster that referenced this issue Aug 6, 2024
for ManyToMany relationships when updating constraints

Fix jhipster#26910
@mshima mshima closed this as completed in acc46e4 Aug 6, 2024
@mraible mraible added this to the 8.7.0 milestone Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants