IF Commons GitHub

groupMember

concept

A principal's place in a group: a user, or another group

Model identity. Written in commons/data/models/identity/concepts.ts:126. Identified by group, member.

Governance: attributes

addedAtinstantrequired

When the principal was added

Becomes the column added_at of group_member.

Written at commons/data/models/identity/concepts.ts:126

Governance: relationships

groupone

The group To userGroup. Written at commons/data/models/identity/concepts.ts:126

memberone

The user or the group that is a member To principal. Written at commons/data/models/identity/concepts.ts:126

Logical: the table

Projects to the table group_member with the primary key group_user_group_principal_id, member_principal_id.

ColumnTypeNullRoleFrom
added_attimestampfalseattributegroupMember.addedAt
group_user_group_principal_idtextfalsereferencegroupMember.group
member_principal_idtextfalsereferencegroupMember.member

Physical: SQL

CREATE TABLE IF NOT EXISTS "group_member" (
    "group_user_group_principal_id" VARCHAR NOT NULL,
    "member_principal_id" VARCHAR NOT NULL,
    "added_at" TIMESTAMPTZ NOT NULL,
    PRIMARY KEY ("group_user_group_principal_id", "member_principal_id"),
    CONSTRAINT "group_member_group_user_group_principal_id_fk" FOREIGN KEY ("group_user_group_principal_id") REFERENCES "user_group" ("principal_id"),
    CONSTRAINT "group_member_member_principal_id_fk" FOREIGN KEY ("member_principal_id") REFERENCES "principal" ("principal_id")
);

Physical: the typed table

Read and written from TypeScript with the types the model gives: import { groupMember } 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 { groupMember } from "@intellectual-frontiers/data/sql/typed/models";

const rows = await from(groupMember).select((s) => ({ groupUserGroupPrincipalId: s.groupMember.groupUserGroupPrincipalId, memberPrincipalId: s.groupMember.memberPrincipalId })).run(runner);

Titles, headings, exports, tables, columns and requirements. Esc closes.