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

Allow to define default value in JDL for a field

Open OmarHawk opened this issue 1 year ago • 0 comments

Overview of the feature request

It would be really helpful to define a default value in JDL for a given field. For example, we want to automatically have checkboxes checked / the proper values set in database with defaultValue option in liquibase on the column.

Motivation for or Use Case

Of course, we can implement this as a blueprint by ourselves, but if that's something that would be relevant/helpful for additional users apart from us, I could also contribute this as Pull Request here.

Idea would the be to have it like this, so as an annotation

entity A {
  @defaultValue(true) someBoolean Boolean
  @defaultValue("DEFAULT") someString String
  @defaultValue(1) someLong Long
}

This will then:

  • Change the default value in the form.service (Angular -> or others)
  • Set in Liquibase changelog the appropriate values

This would reduce the manual diff / effort for upgrading to a new JHipster version and may be helpful to others than us.

Related issues or PR

#13261

  • [x] Checking this box is mandatory (this is just to show you read everything)

OmarHawk avatar Feb 05 '24 13:02 OmarHawk