Support for virtual fields from config #6270
Replies: 5 comments 1 reply
-
We just stumbled upon this. This would really be a required thing for a more sophisticated site. |
Beta Was this translation helpful? Give feedback.
-
I can create a PR on this, the only what I'm thinking about is an interface for that (whatever prop |
Beta Was this translation helpful? Give feedback.
-
I think also payload core has a use case for this with the lexical HTML feature which saved html inside the database. |
Beta Was this translation helpful? Give feedback.
-
PR: #6983 |
Beta Was this translation helpful? Give feedback.
-
Released iin https://github.com/payloadcms/payload/releases/tag/v3.0.0-beta.108 |
Beta Was this translation helpful? Give feedback.
-
There's a good blog post about Virtual Fields https://payloadcms.com/blog/learn-how-virtual-fields-can-help-solve-common-cms-challenges
And yes, it's true, they are great. But if you are using SQL database, the schema for this field is still created, because there's no way to determine whatever field is "virtual" or not.
My proposal would be to add a field option like:
isVirtual: true
ordb: { store: false }
so then in our adapter we can skip the schema for this field, but instead we should validate forafterRead
hook existance and automatically delete this field beforecreate
/update
operation.PR: #7621
Beta Was this translation helpful? Give feedback.
All reactions