generator-jhipster icon indicating copy to clipboard operation
generator-jhipster copied to clipboard

Incremental changelog won't count up timestamp or won't use the current timestamp but always the creation timestamp leading to incorrectly overwritten changelog files

Open OmarHawk opened this issue 1 year ago • 0 comments

Overview of the issue

We do have an issue with incremental changelog generation, since v8. We have an existing application with a defined jdl, modify the jdl and let the jhipster jdl jdl.jdl command run. The problem is, it will always use the creationTimeStamp for file names as prefix for the changelog files and for changelog ids, therefore, two consecutive updates to the very same entity will override each other and you need to manually do something about it, or your liquibase changelog will break. In previous versions (7.9.3), the current timestamp was used instead, so everytime the jdl command was run, a completely new set of files was produced.

Motivation for or Use Case

Shouldn't have to manually fix something over the application lifecycle.

Reproduce the error
  1. Create a basic application.
  2. Generate an initial schema using jhipster jdl jdl.jdl --incremental-changelog command for incremental changelogs
  3. Change an entity in the jdl (remove a field) and let the jhipster jdl jdl.jdl command run again
  4. Change the same entity again (add a field) and let the jhipster jdl jdl.jdl command run again and see that JHipster tries to override the already existing (and possibly already applied to database) file

You can see the last step in the following screenshots. Here, the last step is visible, and JHipster tried to override the already existing update file: 2024-02-21_17h33_59 This is the file content before JHipster does so: 2024-02-21_17h42_04 And this is after JHipster has done so: 2024-02-21_17h42_54

Related issues

Nothing found

Suggest a Fix
JHipster Version(s)

8.1.0

JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "session",
    "baseName": "testjdl",
    "buildTool": "maven",
    "cacheProvider": "no",
    "clientFramework": "angular",
    "clientTestFrameworks": [],
    "clientTheme": "none",
    "creationTimestamp": 1708532537253,
    "databaseType": "sql",
    "devDatabaseType": "mysql",
    "devServerPort": 4200,
    "enableGradleEnterprise": null,
    "enableHibernateCache": false,
    "enableSwaggerCodegen": false,
    "enableTranslation": true,
    "entities": [
      "StreamConnectionidProtocol"
    ],
    "feignClient": false,
    "gradleEnterpriseHost": null,
    "incrementalChangelog": true,
    "jhipsterVersion": "8.1.0",
    "languages": [
      "de",
      "en"
    ],
    "lastLiquibaseTimestamp": 1708532597000,
    "messageBroker": false,
    "microfrontend": null,
    "microfrontends": [],
    "nativeLanguage": "de",
    "packageName": "com.mycompany.myapp",
    "prodDatabaseType": "mysql",
    "reactive": false,
    "searchEngine": "elasticsearch",
    "serverPort": null,
    "serverSideOptions": [
      "searchEngine:elasticsearch"
    ],
    "serviceDiscoveryType": false,
    "testFrameworks": [],
    "websocket": false,
    "withAdminUi": true
  }
}
Environment and Tools

openjdk version "17.0.7" 2023-04-18 LTS OpenJDK Runtime Environment (Red_Hat-17.0.7.0+7-1) (build 17.0.7+7-LTS) OpenJDK 64-Bit Server VM (Red_Hat-17.0.7.0+7-1) (build 17.0.7+7-LTS, mixed mode, sharing)

git version 2.43.0.windows.1

node: v18.19.0 npm: 10.2.3

Docker version 24.0.7-rd, build 72ffacf

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
@ChangelogDate("20240221162317")
entity StreamConnectionidProtocol {
  name String required maxlength(30)
  description String maxlength(30)
  info String
  anotherInfoAgain String
}

Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
  • [x] Checking this box is mandatory (this is just to show you read everything)

OmarHawk avatar Feb 21 '24 16:02 OmarHawk