Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions generators/liquibase/incremental-liquibase.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
<dropColumn tableName="<%- entity.entityTableName %>">
<%_ for (field of removedFields) { _%>
<column name="<%- field.columnName %>"/>
<%_ if (field.shouldCreateContentType) { _%>
<column name="<%- field.columnName %>_content_type"/>
<%_ }
_%>
<%_ } _%>
</dropColumn>
</changeSet>
Expand Down
Loading