Auto-increment fields #1709
Replies: 3 comments 6 replies
-
Yes:
|
Beta Was this translation helpful? Give feedback.
-
When I define an auto-increment field in an abstract type, will the counter be shared between all concrete types derived from it or will they have their own counters? (assuming the unique constraint is delegated) |
Beta Was this translation helpful? Give feedback.
-
Conceptually coupling auto-increment primarily to a type seems wrong. It's a kind of default value, so I'd expect to specify where I specify a default value. While you could define a type for convenience, that can easily lead to unintended behaviour if such a type is ever used as a reference/foreign key (admittedly rare in EdgeDB due to its first class link support). Also allowing auto-increment fields without a unique index seems looks like a foot gun to me. The values will usually be unique, but explicitly specified values or a reset sequence can mess up that guarantee. |
Beta Was this translation helpful? Give feedback.
-
I understand the primary key is always a UUID in EdgeDB. But sometimes it'd be nice to have a smaller numeric secondary id. An auto-increment field combined with a unique (secondary) index on it would fit that goal.
Is there any way to define auto-increment fields in EdgeDB?
Beta Was this translation helpful? Give feedback.
All reactions