MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / Indexes

Method Indexes

app/controlplane/pkg/data/ent/schema/apitoken.go:71–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69}
70
71func (APIToken) Indexes() []ent.Index {
72 return []ent.Index{
73 // names are unique within a organization and affects only to non-deleted items
74 // These are for org level tokens
75 index.Fields("name").Edges("organization").Unique().Annotations(
76 entsql.IndexWhere("revoked_at IS NULL AND project_id IS NULL"),
77 ),
78
79 // for project level tokens, we scope the uniqueness to the organization and project
80 index.Fields("name").Edges("project").Unique().Annotations(
81 entsql.IndexWhere("revoked_at IS NULL AND project_id IS NOT NULL"),
82 ),
83
84 // for instance-level tokens, names must be unique across all instance tokens
85 index.Fields("name").Unique().Annotations(
86 entsql.IndexWhere("revoked_at IS NULL AND organization_id IS NULL"),
87 ),
88 }
89}

Callers

nothing calls this directly

Calls 4

AnnotationsMethod · 0.80
UniqueMethod · 0.45
EdgesMethod · 0.45
FieldsMethod · 0.45

Tested by

no test coverage detected