Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As User - I want to be able to set default values for fields within entities #1045

Open
yuval-hazaz opened this issue Dec 23, 2020 · 4 comments
Assignees
Labels
epic: DB schema impact: Value Proposition initiatives that focus on improving the value that users are getting from the service type: feature request

Comments

@yuval-hazaz
Copy link
Member

yuval-hazaz commented Dec 23, 2020

As User - I want to be able to set default values for fields within entities, so that I can easily configure the initial values for new entity instances.

image

The value of this feature:

  1. Efficiency: By allowing developers to set default values for fields within entities, the feature can save time and effort when creating new entity instances. Developers can pre-configure default values that are appropriate for the majority of instances, rather than having to manually enter the same value each time a new instance is created.
  2. Consistency: Default values can ensure that newly created entity instances are consistent and adhere to certain standards or rules. This can help prevent errors or discrepancies in the data, as well as simplify the data entry process for end-users.
  3. Flexibility: Default values can be modified on an individual entity instance basis, allowing for greater flexibility in managing the data. This can be particularly useful when dealing with unique or unusual cases that do not fit the default value.
  4. User Experience: Default values can improve the user experience by providing a more intuitive and streamlined data entry process. By pre-filling fields with default values, users can focus on providing the unique information for each instance, rather than having to enter the same information repeatedly.

Requirements:

  1. The feature should allow developers to set a default value for any field within an entity.
  2. The default value should be set at the field level and should be configurable during the entity creation or update process.
  3. The default value should be applied to the field whenever a new entity instance is created.
  4. The default value should be displayed to the user in any user interface or reporting tool that presents the entity data.
  5. The default value should be modifiable on an individual entity instance basis.
  6. The feature should support different data types, such as string, numeric, date, boolean, and more.
  7. The feature should support more complex data types, such as lists and objects.
  8. The feature should be backward compatible with existing entities.
  9. The feature should have appropriate security controls to ensure that only authorized users can modify default values.
  10. The feature should have appropriate documentation to guide developers on how to use it and its limitations.
  11. The feature should be integrated with existing entity validation rules to ensure that default values are valid for the field they are set on.
  12. The feature should be tested thoroughly to ensure that it works as intended and does not introduce any unintended side effects or regressions.
@kurdi-dev
Copy link

hoping to see this happen!

@yuval-hazaz
Copy link
Member Author

@GreenMachine01 let's add this to our backlog as part of extending support for more schema flags and attributes

@GreenMachine01 GreenMachine01 changed the title Default values for entity fields As User - I want to be able to set default values for fields within entities Mar 19, 2023
@GreenMachine01 GreenMachine01 added the impact: Value Proposition initiatives that focus on improving the value that users are getting from the service label Mar 19, 2023
@yuval-hazaz
Copy link
Member Author

We support this feature using custom attributes - users can use the Prisma attribute @default() and use all the different options that Prisma supports.

We should document this in out docs "Use Default Value on Entity Fields" and explain how to do it.

Although we can add support for a built-in text field that will be converted to an attribute, I think it will be very time-consuming and hard to maintain support for all different options, including functions like now() etc.

I suggest leaving this open for the user to use the Custom Attributes field instead. We can also add an example in the tooltip on using the field to configure a default value.

@GreenMachine01 please review and decide whether we should close this and pass the tasks needed for the docs to @dericksozo

@GreenMachine01
Copy link
Contributor

@yuval-hazaz I agree that it sounds like we can park this one for now. Creating a task for documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic: DB schema impact: Value Proposition initiatives that focus on improving the value that users are getting from the service type: feature request
Projects
Status: Ready for dev
Development

No branches or pull requests

3 participants