From 16ad7a809dbfce2498d4dac3201023e19872ef41 Mon Sep 17 00:00:00 2001 From: 218broadway-svg <254509107+218broadway-svg@users.noreply.github.com> Date: Fri, 8 May 2026 21:05:44 +1000 Subject: [PATCH] Fix AnyBlob content type column removal --- .../liquibase/incremental-liquibase.spec.ts | 34 +++++++++++++++++++ .../changelog/updated_entity.xml.ejs | 4 +++ 2 files changed, 38 insertions(+) diff --git a/generators/liquibase/incremental-liquibase.spec.ts b/generators/liquibase/incremental-liquibase.spec.ts index dcc5a425d088..7de76d2ae159 100644 --- a/generators/liquibase/incremental-liquibase.spec.ts +++ b/generators/liquibase/incremental-liquibase.spec.ts @@ -559,6 +559,40 @@ entity Customer { }); }); + describe('when removing a blob field with content type', () => { + before(async () => { + await helpers.runJDL(` +${jdlApplication} +entity Customer { + name String + contract AnyBlob +} +`); + + await helpers + .runJDLInApplication( + ` +${jdlApplication} +entity Customer { + name String +} +`, + ) + .withMockedSource({ except: exceptSourceMethods }) + .withMockedJHipsterGenerators({ except: exceptMockedGenerators }) + .withOptions({ + creationTimestamp: '2020-01-02', + }); + }); + + it('should drop the blob field content type column', () => { + const updatedChangelog = `${SERVER_MAIN_RES_DIR}config/liquibase/changelog/20200102000100_updated_entity_Customer.xml`; + + runResult.assertFileContent(updatedChangelog, 'column name="contract"'); + runResult.assertFileContent(updatedChangelog, 'column name="contract_content_type"'); + }); + }); + describe('when adding a relationship', () => { before(async () => { await helpers diff --git a/generators/liquibase/templates/src/main/resources/config/liquibase/changelog/updated_entity.xml.ejs b/generators/liquibase/templates/src/main/resources/config/liquibase/changelog/updated_entity.xml.ejs index b54c9b153ae1..8798e8344cab 100644 --- a/generators/liquibase/templates/src/main/resources/config/liquibase/changelog/updated_entity.xml.ejs +++ b/generators/liquibase/templates/src/main/resources/config/liquibase/changelog/updated_entity.xml.ejs @@ -50,6 +50,10 @@ <%_ for (field of removedFields) { _%> + <%_ if (field.shouldCreateContentType) { _%> + + <%_ } + _%> <%_ } _%>