createdViacode of createdViarequiredHow the account came to be
Becomes the column created_via of user_account.
Written at commons/data/models/identity/concepts.ts:68
A person's way in: who signs in, and where it stands
Model identity. Written in commons/data/models/identity/concepts.ts:64. Identified by principal.
createdViacode of createdViarequiredHow the account came to be
Becomes the column created_via of user_account.
Written at commons/data/models/identity/concepts.ts:68
lastAuthenticatedAtinstantoptionalWhen the user last proved who they are
Becomes the column last_authenticated_at of user_account.
Written at commons/data/models/identity/concepts.ts:70
localetextoptionalThe language the user wants to be spoken to in
Becomes the column locale of user_account.
Written at commons/data/models/identity/concepts.ts:71
lockedUntilinstantoptionalUntil when the account is locked, where it is
Becomes the column locked_until of user_account.
Written at commons/data/models/identity/concepts.ts:69
loginIdentifiertextrequiredpersonal dataWhat the user signs in by, unique within its home tenant
Becomes the column login_identifier of user_account.
Annotations: privacy.personal={"category":"Username","purposes":["let the user sign in"]}
Written at commons/data/models/identity/concepts.ts:67
timeZonetextoptionalThe time zone the user's times are shown in
Becomes the column time_zone of user_account.
Written at commons/data/models/identity/concepts.ts:72
homeTenantoptionalThe tenant whose pool of users it is in; empty for a user who joins tenants by membership To tenant. Written at commons/data/models/identity/concepts.ts:78
persononeThe person the account is for To person. Written at commons/data/models/identity/concepts.ts:77
primaryEmailoptionalThe address the user is written to To electronicContact. Written at commons/data/models/identity/concepts.ts:79
principaloneThe principal the account is To principal. Written at commons/data/models/identity/concepts.ts:76
Projects to the table user_account with the primary key principal_id.
| Column | Type | Null | Role | From |
|---|---|---|---|---|
created_via | text | false | attribute | userAccount.createdVia |
home_tenant_tenant_id | text | true | reference | userAccount.homeTenant |
last_authenticated_at | timestamp | true | attribute | userAccount.lastAuthenticatedAt |
locale | text | true | attribute | userAccount.locale |
locked_until | timestamp | true | attribute | userAccount.lockedUntil |
login_identifier | text | false | attribute | userAccount.loginIdentifier |
person_party_id | text | false | reference | userAccount.person |
primary_email_electronic_contact_id | text | true | reference | userAccount.primaryEmail |
principal_id | text | false | reference | userAccount.principal |
time_zone | text | true | attribute | userAccount.timeZone |
CREATE TABLE IF NOT EXISTS "user_account" (
"principal_id" VARCHAR NOT NULL PRIMARY KEY,
"login_identifier" VARCHAR NOT NULL,
"created_via" VARCHAR NOT NULL,
"locked_until" TIMESTAMPTZ,
"last_authenticated_at" TIMESTAMPTZ,
"locale" VARCHAR,
"time_zone" VARCHAR,
"person_party_id" VARCHAR NOT NULL,
"home_tenant_tenant_id" VARCHAR,
"primary_email_electronic_contact_id" VARCHAR,
CONSTRAINT "user_account_principal_id_fk" FOREIGN KEY ("principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "user_account_person_party_id_fk" FOREIGN KEY ("person_party_id") REFERENCES "person" ("party_id"),
CONSTRAINT "user_account_home_tenant_tenant_id_fk" FOREIGN KEY ("home_tenant_tenant_id") REFERENCES "tenant" ("tenant_id"),
CONSTRAINT "user_account_primary_email_electronic_contact_id_fk" FOREIGN KEY ("primary_email_electronic_contact_id") REFERENCES "electronic_contact" ("electronic_contact_id"),
CONSTRAINT "user_account_home_tenant_tenant_id_login_identifier_uq" UNIQUE ("home_tenant_tenant_id", "login_identifier"),
CONSTRAINT "user_account_created_via_ck" CHECK ("created_via" IN ('invited', 'self_signup', 'directory', 'federated', 'admin'))
);CREATE TABLE IF NOT EXISTS "user_account" (
"principal_id" TEXT NOT NULL PRIMARY KEY,
"login_identifier" TEXT NOT NULL,
"created_via" TEXT NOT NULL,
"locked_until" TIMESTAMPTZ,
"last_authenticated_at" TIMESTAMPTZ,
"locale" TEXT,
"time_zone" TEXT,
"person_party_id" TEXT NOT NULL,
"home_tenant_tenant_id" TEXT,
"primary_email_electronic_contact_id" TEXT,
CONSTRAINT "user_account_principal_id_fk" FOREIGN KEY ("principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "user_account_person_party_id_fk" FOREIGN KEY ("person_party_id") REFERENCES "person" ("party_id"),
CONSTRAINT "user_account_home_tenant_tenant_id_fk" FOREIGN KEY ("home_tenant_tenant_id") REFERENCES "tenant" ("tenant_id"),
CONSTRAINT "user_account_primary_email_electronic_contact_id_fk" FOREIGN KEY ("primary_email_electronic_contact_id") REFERENCES "electronic_contact" ("electronic_contact_id"),
CONSTRAINT "user_account_home_tenant_tenant_id_login_identifier_uq" UNIQUE ("home_tenant_tenant_id", "login_identifier"),
CONSTRAINT "user_account_created_via_ck" CHECK ("created_via" IN ('invited', 'self_signup', 'directory', 'federated', 'admin'))
);CREATE TABLE IF NOT EXISTS "user_account" (
"principal_id" TEXT NOT NULL PRIMARY KEY,
"login_identifier" TEXT NOT NULL,
"created_via" TEXT NOT NULL,
"locked_until" TEXT,
"last_authenticated_at" TEXT,
"locale" TEXT,
"time_zone" TEXT,
"person_party_id" TEXT NOT NULL,
"home_tenant_tenant_id" TEXT,
"primary_email_electronic_contact_id" TEXT,
CONSTRAINT "user_account_principal_id_fk" FOREIGN KEY ("principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "user_account_person_party_id_fk" FOREIGN KEY ("person_party_id") REFERENCES "person" ("party_id"),
CONSTRAINT "user_account_home_tenant_tenant_id_fk" FOREIGN KEY ("home_tenant_tenant_id") REFERENCES "tenant" ("tenant_id"),
CONSTRAINT "user_account_primary_email_electronic_contact_id_fk" FOREIGN KEY ("primary_email_electronic_contact_id") REFERENCES "electronic_contact" ("electronic_contact_id"),
CONSTRAINT "user_account_home_tenant_tenant_id_login_identifier_uq" UNIQUE ("home_tenant_tenant_id", "login_identifier"),
CONSTRAINT "user_account_created_via_ck" CHECK ("created_via" IN ('invited', 'self_signup', 'directory', 'federated', 'admin'))
);Read and written from TypeScript with the types the model gives: import { userAccount } 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 { userAccount } from "@intellectual-frontiers/data/sql/typed/models";
const rows = await from(userAccount).select((s) => ({ principalId: s.userAccount.principalId, loginIdentifier: s.userAccount.loginIdentifier })).run(runner);