Skip to content

Commit

Permalink
Merge pull request #1344 from OmarHawk/feature/default-values
Browse files Browse the repository at this point in the history
Add documentation for jhipster/generator-jhipster#25094
  • Loading branch information
DanielFran authored Apr 30, 2024
2 parents 829d6dd + a908e3b commit 6acaed4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
7 changes: 4 additions & 3 deletions pages/jdl/entities.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ entity <entity name> [(<table name>)] {
- `<field type>` the JHipster supported type of the field,
- and as an option:
- `<entity javadoc>` the documentation of the entity,
- `<entity annotation>` the options for the entity (see [Options][] for a complete list of available options),
- `<entity annotation>` the options for the entity (see [OptionsEntity][] for a complete list of available options),
- `<table name>` the database table name (if you want to specify something different that the name automatically computed from the entity name),
- `<field javadoc>` the documentation of the field,
- `<field annotation>` the options for the field,
- `<field annotation>` the options for the field (see [OptionsField][] for a complete list of available options),
- `<validation>` the validations for the field.

---
Expand Down Expand Up @@ -258,4 +258,5 @@ Each field type has its own validation list. Here are the types supported in the
</tr>
</table>

[Options]: options#available-options "Options"
[OptionsEntity]: options#entity-options "Options"
[OptionsField]: options#field-options "Options"
32 changes: 29 additions & 3 deletions pages/jdl/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,13 +402,15 @@ However, for custom options, they will be generated under and `options` key in t

### Available options

Here are the entity options supported in the JDL:

_Not what you're looking for? Check the [application options](/jdl/applications#available-application-configuration-options)._

#### Entity options

Here are the entity options supported in the JDL:

<table class="table table-striped table-responsive">
<tr>
<th>JDL option name</th>
<th>JDL option name (entity)</th>
<th>Option type</th>
<th>Default value</th>
<th>Possible values</th>
Expand Down Expand Up @@ -510,6 +512,30 @@ _Not what you're looking for? Check the [application options](/jdl/applications#
</tr>
</table>

#### Field options

Here are the field options supported in the JDL:

<table class="table table-striped table-responsive">
<tr>
<th>JDL option name (field)</th>
<th>Default value</th>
<th>Possible values</th>
<th>Comment</th>
</tr>
<tr>
<td>defaultValue</td>
<td>undefined</td>
<td>any value fitting to the datatype of the field, e.g. "myDefaultValue" or 42 or true</td>
<td>Will define a fixed default value on database schema side on the column, as well as adjust the clients passing in the option as default from input forms (only Angular for now)</td>
</tr>
<tr>
<td>defaultValueComputed</td>
<td>undefined</td>
<td>database functions to generate default values for a column, e.g. "NOW(6)"</td>
<td>This will generate a default value on database level using the given function</td>
</tr>
</table>
---

### See also
Expand Down

0 comments on commit 6acaed4

Please sign in to comment.