MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / initialSchemaInternal

Function initialSchemaInternal

schema/schema.go:771–869  ·  view source on GitHub ↗
(namespace uint64, all bool)

Source from the content-addressed store, hash-verified

769}
770
771func initialSchemaInternal(namespace uint64, all bool) []*pb.SchemaUpdate {
772 var initialSchema []*pb.SchemaUpdate
773
774 initialSchema = append(initialSchema, []*pb.SchemaUpdate{
775 {
776 Predicate: "dgraph.type",
777 ValueType: pb.Posting_STRING,
778 Directive: pb.SchemaUpdate_INDEX,
779 Tokenizer: []string{"exact"},
780 List: true,
781 },
782 {
783 Predicate: "dgraph.drop.op",
784 ValueType: pb.Posting_STRING,
785 },
786 {
787 Predicate: "dgraph.graphql.schema",
788 ValueType: pb.Posting_STRING,
789 },
790 {
791 Predicate: "dgraph.graphql.xid",
792 ValueType: pb.Posting_STRING,
793 Directive: pb.SchemaUpdate_INDEX,
794 Tokenizer: []string{"exact"},
795 Upsert: true,
796 },
797 {
798 Predicate: "dgraph.graphql.p_query",
799 ValueType: pb.Posting_STRING,
800 Directive: pb.SchemaUpdate_INDEX,
801 Tokenizer: []string{"sha256"},
802 },
803 }...)
804
805 if namespace == x.RootNamespace {
806 initialSchema = append(initialSchema, []*pb.SchemaUpdate{
807 {
808 Predicate: "dgraph.namespace.name",
809 ValueType: pb.Posting_STRING,
810 Directive: pb.SchemaUpdate_INDEX,
811 Tokenizer: []string{"exact"},
812 Unique: true,
813 Upsert: true,
814 },
815 {
816 Predicate: "dgraph.namespace.id",
817 ValueType: pb.Posting_INT,
818 Directive: pb.SchemaUpdate_INDEX,
819 Tokenizer: []string{"int"},
820 Unique: true,
821 Upsert: true,
822 },
823 }...)
824 }
825
826 if all || x.WorkerConfig.AclEnabled {
827 // propose the schema update for acl predicates
828 initialSchema = append(initialSchema, []*pb.SchemaUpdate{

Callers 2

InitialSchemaFunction · 0.85
CompleteInitialSchemaFunction · 0.85

Calls 1

NamespaceAttrFunction · 0.92

Tested by

no test coverage detected