.create() operation. Postgress or Mongo? There is the default value for Postgres
I think it should be DB agnostic. And PostgreSQL does handle default value but I see your point hence my preference for it to be handle on the generated XxxInput or on the resolver level.
I agree with you @machi1990 - this can be handled in GraphQL.
I've documented a similar finding in https://github.com/aerogear/graphback/issues/1012#issuecomment-606562493 suggesting this at CRUD layer level. However adding the default value to the input type is probably better as this responsibility is passed down to GraphQL.js.
If this was handled at GraphQL level instead of the database it would only need to be implemented once and will work for any data source.
If this was handled at GraphQL level instead of the database it would only need to be implemented once and will work for any data source.
Agreed, thanks for the link to the comment. It is very detailed there.
It can be db agnostic by setting the default value on the input type:
It can be db agnostic by setting the default value on the input type:
Yes, and it could be the best appoach. An option I considered here https://github.com/aerogear/graphback/issues/1241#issuecomment-625375706.
I'm thinking of taking this issue for a spin.
We current have @db.default, should this be renamed to @default or @defaultValue following this comment https://github.com/aerogear/graphback/pull/1396#discussion_r436640893?
/cc @craicoverflow
Sounds good @machi1990. I think it should be renamed to @default(value: true). We could use parseMarker if you want to do @default true.
Although the latter is shorter, I think we should be sticking with a single annotation syntax for all metadata. This means users will not need to reference docs each time to see which one to use.
Sounds good @machi1990. I think it should be renamed to
@default(value: true). We could useparseMarkerif you want to do@default true.
Although the latter is shorter, I think we should be sticking with a single annotation syntax for all metadata. This means users will not need to reference docs each time to see which one to use.
+1 on sticking to one syntax. I'll give this a shot with @default(value: <value here>)