Possible bug in GraphQL layer in Dgraph when altering schema via /alter

How do you find out these unused fields?

Unfortunately this is not always the case, think about this schema as Abhimanyu pointed out.

type Temp {
  name
}

type Temp2 {
  name @dgraph(pred: "Temp.name")
}

This can’t be the default behaviour inside Dgraph because as pointed out earlier in a DQL schema a predicate can be referenced by multiple types. We can build this as a special case in Dgraph or in Slash that if the predicate within the type is only referenced by that type, then you also issue a command to drop them. Note that dropping a type is cheap but dropping predicates requires marking all data for them for deletion so would take more time.