Skip to content

Allow intentionally defining an id field #1016

@tysonzero

Description

@tysonzero

I would like to allow defining the following:

User
    id Int64
    ...
    Primary ...
  • This should suppress all the existing magic such as generating a UserId type.

  • UserId would be an EntityField User Int64.

  • The User type would include a userId :: Int64 field.

  • All the Key-based stuff would be based on the Primary field.

As I have used persistent more and more, I have noticed that a lot of the pain points are either due to not being able to treat regular fields more like id, or due to not being able to treat id more like a regular field. So I would like to slowly unify id with other fields in a backwards compatible way.

This change in isolation is less useful than it will be after changes like #995 are implemented, but I similarly think that #995 is less useful without this change. So I think it makes sense to implement this first in isolation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions