vendure-ecommerce/vendure

defaultValue won't be applied for customFields

Opened this issue · 0 comments

Describe the bug
When i define a defaultValue for a custom field of type string on the Product entity, it always ends up being null in the database. For type int it always ends up being 0, despite of what i set in the config, e.g. 101.

To Reproduce
Steps to reproduce the behavior:

  1. Add custom field (type "string", with a desired defaultValue) in the vendure config, for entity Product
  2. Apply migrations
  3. Navigate to "Product"
  4. Fill out required fields, already note that there is no value visible in the newly added custom field.
  5. Click "Create"
  6. In the network tab, the value for the custom field is null
  7. If you check the database, the value is null as well.

Expected behavior
Default values behave as intended.

Environment (please complete the following information):

  • @vendure/core version: 3.1.0
  • Nodejs version 20.17.0
  • Database (mysql/postgres etc): sqlite

Additional context
Reproduction: https://github.com/KilianSSL/vendure-custom-field-default-value