You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We support default values for fields, but their treatment varies based on the @pk annotation. We should examine how we can make this uniform.
There are three kinds of field initialization/update we need to support:
a system-specified value that users cannot specify (@pk id: Int = autoIncrement, createdAt: Instant = now, etc. Here, we could introduce a new readonly keyword (but maybe infer it for the typical @pk id: Int = autoIncrement case).
have a default value, and users can specify a different one (the @pk id: Uuid = generate_uuid() case, but also things like published: Boolean = false, which we already support)
a special case of system-specified value (updatedAt), which is computed by the system every time there is an update. Users cannot specify it, and it doesn't have a default either.
The text was updated successfully, but these errors were encountered:
To support client-generated `Uuid` optionally, this PR now includes a field corresponding to the primary key for creating mutations.
We need to have a formalism for this support. For example, we don't implement a similar mechanism for `autoIncrement()`ed `Int`s, since that is likely to cause confusion when a system-generated value collides with a previous user-specified value.
The difference is, unlike `generate_uuid()`, `autoIncrement()` relies on database state (the underlying sequence). We can deal with it when we address #926.
To support client-generated `Uuid` optionally, this PR now includes a field corresponding to the primary key for creating mutations.
We need to have a formalism for this support. For example, we don't implement a similar mechanism for `autoIncrement()`ed `Int`s since that is likely to cause confusion when a system-generated value collides with a previous user-specified value. The difference is, unlike `generate_uuid()`, `autoIncrement()` relies on database state (the underlying sequence). We can deal with it when we address #926.
Carrying over from Discord...
We support default values for fields, but their treatment varies based on the
@pk
annotation. We should examine how we can make this uniform.There are three kinds of field initialization/update we need to support:
a system-specified value that users cannot specify (
@pk id: Int = autoIncrement
,createdAt: Instant = now
, etc. Here, we could introduce a newreadonly
keyword (but maybe infer it for the typical@pk id: Int = autoIncrement
case).have a default value, and users can specify a different one (the
@pk id: Uuid = generate_uuid()
case, but also things likepublished: Boolean = false
, which we already support)a special case of system-specified value (
updatedAt
), which is computed by the system every time there is an update. Users cannot specify it, and it doesn't have a default either.The text was updated successfully, but these errors were encountered: