jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.53k stars 4.02k forks source link

command `jhipster jdl ..\order\src\main\jdl\order.jdl` would drop id column of tables #27646

Open flyliu33 opened 18 hours ago

flyliu33 commented 18 hours ago
Overview of the issue
  1. command jhipster jdl ..\order\src\main\jdl\order.jdl would drop id column of tables

no error threw

Motivation for or Use Case

I try to use command jhipster jdl ..\order\src\main\jdl\order.jdl for generating liquibase. but it will create drop id changelog after modifying my jdl files. so I prefer to use jhipster jdl ..\order\src\main\jdl\order.jdl --skip-db-changelog for generating backend code and then using ./mvnw compile liquibase:diff for generating liquibase changelog, though it doesn't seem more reasonable.

Reproduce the error
  1. generating liquibase changelog by command jhipster jdl
  2. run the backend application and create a table
  3. stop the backend application
  4. modify the jdl file
  5. regenerating by command jhipster jdl
Related issues
Suggest a Fix
JHipster Version(s)

8.7.1

JHipster configuration

To provide all information we need, you should run jhipster info in the project root folder (or workspaces root for microservices), and copy/paste the result here. jhipster info removes sentitive information like rememberKey, jwtSecretKey. Double check if there is any other sensitive info.

As alternative you can add a JDL wrapped in below structure

.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "microservice",
    "authenticationType": "jwt",
    "baseName": "order",
    "buildTool": "maven",
    "cacheProvider": "redis",
    "clientFramework": "no",
    "clientTestFrameworks": null,
    "clientTheme": null,
    "creationTimestamp": 1726891146771,
    "databaseType": "sql",
    "devDatabaseType": "mysql",
    "enableHibernateCache": true,
    "enableSwaggerCodegen": true,
    "enableTranslation": false,
    "entities": [
      "Company",
      "Order",
      "ParkingLot"
    ],
    "feignClient": true,
    "incrementalChangelog": true,
    "jhipsterVersion": "8.7.1",
    "lastLiquibaseTimestamp": 1729478625000,
    "messageBroker": "kafka",
    "microfrontend": null,
    "microfrontends": [],
    "nativeLanguage": "zh-cn",
    "packageName": "com.pu.order",
    "prodDatabaseType": "mysql",
    "reactive": false,
    "searchEngine": false,
    "serverPort": "8082",
    "serverSideOptions": [
      "messageBroker:kafka",
      "enableSwaggerCodegen:true"
    ],
    "serviceDiscoveryType": "consul",
    "skipClient": true,
    "skipUserManagement": true,
    "syncUserWithIdp": null,
    "testFrameworks": [
      "gatling"
    ],
    "websocket": false,
    "withAdminUi": null
  }
}
Environment and Tools

openjdk version "17.0.12" 2024-07-16 LTS OpenJDK Runtime Environment Corretto-17.0.12.7.1 (build 17.0.12+7-LTS) OpenJDK 64-Bit Server VM Corretto-17.0.12.7.1 (build 17.0.12+7-LTS, mixed mode, sharing)

git version 2.45.1.windows.1

node: v20.17.0 npm: 10.8.2

Docker version 27.1.1, build 6312585

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
/**
 * Company
 */
@ChangelogDate("20241018060451")
entity Company {
  id UUID
  name String
  contact String
}

/**
 * Order
 */
@ChangelogDate("20241018060452")
entity Order (jhi_order) {
  id UUID
  /**
   * Parking type, 0: Street parking, 1: Gated parking
   */
  parkType ParkType required
  /**
   * Order number
   */
  orderNo String required maxlength(32)
  /**
   * Stall number, required when parkType=0
   */
  stallNo String maxlength(32)
  /**
   * License plate number, format like [粤S12345] or new energy [粤S123456]
   */
  licensePlate String required maxlength(8)
  /**
   * Order amount in cents
   */
  orderAmount Long required min(1)
  /**
   * Multiple image files, supports jpg, jpeg and png, max 10M per file
   */
  file String
  /**
   * Entry/exit lane code, choose between this and license plate number
   */
  laneNo String maxlength(32)
  /**
   * Platform transaction order number, linking multiple merchant orders
   */
  dealNo String maxlength(32)
  /**
   * Customer number
   */
  customerNo String maxlength(32)
  /**
   * Actual amount received in cents
   */
  realAmount Long min(1)
  /**
   * Platform service fee in cents
   */
  platformFee Long min(1)
  /**
   * Assistance service fee in cents
   */
  assistFee Long min(1)
  /**
   * Payment status, 0: Unpaid, 1: Payment successful, 2: Payment failed
   */
  payState PayState required
  /**
   * Platform order number
   */
  platformNo String maxlength(15)
  /**
   * Creation time
   */
  createTime LocalDate
  /**
   * Entry time
   */
  entryTime LocalDate
  /**
   * Payment time
   */
  payTime LocalDate
  /**
   * Exit deadline
   */
  exitDeadline LocalDate
  /**
   * Exit time
   */
  exitTime LocalDate
}

/**
 * Parking Lot
 */
@ChangelogDate("20241018060453")
entity ParkingLot {
  id UUID
  parkNo String
  name String
  capacity Integer
}

enum ParkType {
  ROAD,
  ENCLOSE
}

enum PayState {
  UNPAY,
  PAYED,
  FAILED
}

relationship OneToMany {
  /**
   * Creditor company
   */
  Company{company} to Order{company}
  /**
   * Assisting company
   */
  Company{assistCompany} to Order{assistCompany}
  /**
   * Parking lot
   */
  ParkingLot{order} to Order{parkingLot}
}

paginate Company, Order, ParkingLot with infinite-scroll
search Company, Order, ParkingLot with no
microservice Company, Order, ParkingLot with Order
clientRootFolder Company, Order, ParkingLot with Order

The information is mandatory for bug reports. This will allow us to use automated tests and genarate the broken sample using jhipster from-issue command.

Browsers and Operating System

Edition Windows 11 Pro Version 23H2 Installed on ‎8/‎19/‎2024 OS build 22631.4317 Experience Windows Feature Experience Pack 1000.22700.1041.0

mshima commented 7 hours ago

You have incrementalChangelog enabled which generates new changelogs on jdl changes. You can disable using --no-incremental-changelog.