Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Creating 1:1 relationships in Graphback #1661

Open
Tracked by #2023
craicoverflow opened this issue Jul 7, 2020 · 3 comments
Open
Tracked by #2023

Creating 1:1 relationships in Graphback #1661

craicoverflow opened this issue Jul 7, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@craicoverflow
Copy link

The only way to make a @oneToOne field truly 1:1 is by also adding @unique.

"""@model"""
type User {
  id: ID
  name: String
  """
  @oneToOne
  @unique
  """
  note: Note
}

Otherwise it is identical to a 1:M/M:1 relationship and is not restricted.

I see this as a bug. It would seem strange to have to add @unique aswell, as you would expect the @oneToOne annotation to handle this.

@craicoverflow
Copy link
Author

If it is a docs issue, cc @machi1990 as you are working on migrations docs right now.

@craicoverflow craicoverflow added question Further information is requested triage labels Jul 7, 2020
@wtrocki
Copy link
Contributor

wtrocki commented Jul 7, 2020

No strong opinion but seems like code issue. Let's triage this

@wtrocki wtrocki modified the milestone: graphback@0.15.0 Jul 21, 2020
@wtrocki wtrocki added bug Something isn't working and removed question Further information is requested triage labels Jul 21, 2020
@wtrocki wtrocki added this to the graphback@0.15.0 milestone Jul 21, 2020
@machi1990
Copy link
Contributor

I see this as a bug. It would seem strange to have to add @unique aswell, as you would expect the @oneToOne annotation to handle this.

With Relational databases, GraphQL Migrations can take care of this.

I wonder how can have something similar for MongoDB without having to track relationships on code.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants