Report a GraphQL Bug
I have a scenario where I need to update the existing schema(containing 2 types Type1 & Type2) with relationships/edges after few 100’s of records are already been inserted into those respective types. Edges represent a relationship where Type1.predicate1 = Type2.predicate2. I am unable to create such relationship which automatically created the edges for the respective nodes.
Detailed Explanation:
Phase-0 (at time t=0):
schema
# Define Directives and index
initial_release_date: dateTime @index(year) .
name: string @index(exact, term) @lang .
type: [uid] .
# Define Types
type Person {
name
}
type Movie {
name
initial_release_date
}
Phase-1 (at time t=X seconds):
– Now few 100’s of records are stored in the db already. And we updated the schema with few relationships.
new schema
# Define Directives and index
director.film: [uid] @reverse .
actor.film: [uid] @count .
initial_release_date: dateTime @index(year) .
name: string @index(exact, term) @lang .
starring: [uid] .
type: [uid] .
# Define Types
type Person {
name
director.film
actor.film
}
type Movie {
name
initial_release_date
starring
}
But here the edges are not updated automatically as there is not way to mention the base condition for the relationship. And for the new records/nodes added in both the types, we have to manually add the edge in mutation request.
What edition and version of Dgraph are you using?
Edition:
- community edition
If you are using the community edition or enterprise edition of Dgraph, please list the version:
Dgraph Version
v23.0.0
Have you tried reproducing the issue with the latest release?
Yes, I am able to reproduce the same.
Steps to reproduce the issue (paste the query/schema if possible)
Step-1:
Add the below schema
# Define Directives and index
initial_release_date: dateTime @index(year) .
name: string @index(exact, term) @lang .
type: [uid] .
# Define Types
type Person {
name
}
type Movie {
name
initial_release_date
}
Step-2:
Now add few mutations and update with new schema
# Define Directives and index
director.film: [uid] @reverse .
actor.film: [uid] @count .
initial_release_date: dateTime @index(year) .
name: string @index(exact, term) @lang .
starring: [uid] .
type: [uid] .
# Define Types
type Person {
name
director.film
actor.film
}
type Movie {
name
initial_release_date
starring
}
Expected behaviour and actual result.
Expected:
The edges to be created automatically with an option to specify the base condition
Actual:
No edge is being formed directly.