externalIdtextoptionalWhat a directory calls the group, where it keeps it
Becomes the column external_id of user_group.
Written at commons/data/models/identity/concepts.ts:118
A set of principals that is granted what its members are
Model identity. Written in commons/data/models/identity/concepts.ts:113. Identified by principal.
externalIdtextoptionalWhat a directory calls the group, where it keeps it
Becomes the column external_id of user_group.
Written at commons/data/models/identity/concepts.ts:118
nametextrequiredWhat the group is called, unique within its tenant
Becomes the column name of user_group.
Written at commons/data/models/identity/concepts.ts:116
sourcecode of groupSourcerequiredWhere the group is kept
Becomes the column source of user_group.
Written at commons/data/models/identity/concepts.ts:117
principaloneThe principal the group is To principal. Written at commons/data/models/identity/concepts.ts:225
tenantoneThe tenant the group is in To tenant. Written at commons/data/models/identity/concepts.ts:286
Projects to the table user_group with the primary key principal_id.
| Column | Type | Null | Role | From |
|---|---|---|---|---|
external_id | text | true | attribute | userGroup.externalId |
name | text | false | attribute | userGroup.name |
principal_id | text | false | reference | userGroup.principal |
source | text | false | attribute | userGroup.source |
tenant_id | text | false | reference | userGroup.tenant |
CREATE TABLE IF NOT EXISTS "user_group" (
"principal_id" VARCHAR NOT NULL PRIMARY KEY,
"name" VARCHAR NOT NULL,
"source" VARCHAR NOT NULL,
"external_id" VARCHAR,
"tenant_id" VARCHAR NOT NULL,
CONSTRAINT "user_group_principal_id_fk" FOREIGN KEY ("principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "user_group_tenant_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "tenant" ("tenant_id"),
CONSTRAINT "user_group_tenant_id_name_uq" UNIQUE ("tenant_id", "name"),
CONSTRAINT "user_group_source_ck" CHECK ("source" IN ('local', 'directory'))
);CREATE TABLE IF NOT EXISTS "user_group" (
"principal_id" TEXT NOT NULL PRIMARY KEY,
"name" TEXT NOT NULL,
"source" TEXT NOT NULL,
"external_id" TEXT,
"tenant_id" TEXT NOT NULL,
CONSTRAINT "user_group_principal_id_fk" FOREIGN KEY ("principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "user_group_tenant_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "tenant" ("tenant_id"),
CONSTRAINT "user_group_tenant_id_name_uq" UNIQUE ("tenant_id", "name"),
CONSTRAINT "user_group_source_ck" CHECK ("source" IN ('local', 'directory'))
);CREATE TABLE IF NOT EXISTS "user_group" (
"principal_id" TEXT NOT NULL PRIMARY KEY,
"name" TEXT NOT NULL,
"source" TEXT NOT NULL,
"external_id" TEXT,
"tenant_id" TEXT NOT NULL,
CONSTRAINT "user_group_principal_id_fk" FOREIGN KEY ("principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "user_group_tenant_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "tenant" ("tenant_id"),
CONSTRAINT "user_group_tenant_id_name_uq" UNIQUE ("tenant_id", "name"),
CONSTRAINT "user_group_source_ck" CHECK ("source" IN ('local', 'directory'))
);Read and written from TypeScript with the types the model gives: import { userGroup } from "@intellectual-frontiers/data/sql/typed/models". Generated in commons/data/sql/typed/models/identity.auto.ts: do not edit.
import { from } from "@intellectual-frontiers/data/sql/typed";
import { userGroup } from "@intellectual-frontiers/data/sql/typed/models";
const rows = await from(userGroup).select((s) => ({ principalId: s.userGroup.principalId, name: s.userGroup.name })).run(runner);