What do you think is the best practice to represen...
# prisma-whats-new
a
What do you think is the best practice to represent an one-to-one relationship where the โ€œright sideโ€ is optional:
Copy code
type User {
  id: ID! @unique
  username: String! @unique
  email: String! @unique
  password: String!
  salt: String!
  profile: Profile
}

type Profile {
  id: ID! @unique
  firstname: String
  lastname: String
  about: String
}
The
Profile
of the
User
is not mandatory, but should be creatable when the user wants to add additional information. How would you model that? ๐Ÿ™‚
m
Wouldn't you just do?
Copy code
type User {
  id: ID! @unique
  username: String! @unique
  email: String! @unique
  password: String!
  salt: String!
  profile: Profile
}

type Profile {
  id: ID! @unique
  firstname: String
  lastname: String
  about: String
  user: User!
}
just added
user: User!
to Profile
PS why do you have
salt
on user?
is that where you store salt rounds incase you change it later?
a
@max Ah, thanks. I will give it a try. Regarding `salt`: Exactly ๐Ÿ™‚
m
thanks
๐Ÿ‘ 1
a
@max It worked. Thanks a lot ๐Ÿ™‚
๐Ÿฆœ 1
m
๐Ÿ™‚