Adding schema - mutating schema
As we saw in an earlier lesson, Dgraph stores a schema describing the types of predicates.
When we want to add new data to an existing schema, we can just add it. But if we want to add new data in a new schema we have two choices
- Add the data and let Dgraph work out the schema, or
- Specify a schema and then add the data
Dgraph can work out the schema just fine. But functions and filtering can only be applied to indexed predicates and for that we need to specify the schema.
Alter schema to define data types and to add indexes.
Run to alter schema. The index allows applying filter functions, such as searching for all companies that participate in a particular industry.