createdAtinstantrequiredWhen it was made
Becomes the column created_at of credential.
Written at commons/data/models/identity/concepts.ts:144
What a principal proves itself with; the secret is in the kind of credential
Model identity. Written in commons/data/models/identity/concepts.ts:137. Identified by credentialId.
createdAtinstantrequiredWhen it was made
Becomes the column created_at of credential.
Written at commons/data/models/identity/concepts.ts:144
credentialIdidentifierrequiredWhat identifies the credential, made by the application
Becomes the column credential_id of credential.
Written at commons/data/models/identity/concepts.ts:140
kindcode of credentialKindrequiredWhat sort of proof it is
Becomes the column credential_kind_code of credential.
Written at commons/data/models/identity/concepts.ts:141
labeltextoptionalWhat the person calls it
Becomes the column label of credential.
Written at commons/data/models/identity/concepts.ts:143
lastUsedAtinstantoptionalWhen it was last used
Becomes the column last_used_at of credential.
Written at commons/data/models/identity/concepts.ts:145
revokedAtinstantoptionalWhen it ended, where it did
Becomes the column revoked_at of credential.
Written at commons/data/models/identity/concepts.ts:146
statuscode of credentialStatusrequiredWhere it is
Becomes the column status of credential.
Written at commons/data/models/identity/concepts.ts:142
principaloneWhose it is To principal. Written at commons/data/models/identity/concepts.ts:225
Projects to the table credential with the primary key credential_id.
| Column | Type | Null | Role | From |
|---|---|---|---|---|
created_at | timestamp | false | attribute | credential.createdAt |
credential_id | text | false | attribute | credential.credentialId |
credential_kind_code | text | false | reference | credential.kind |
label | text | true | attribute | credential.label |
last_used_at | timestamp | true | attribute | credential.lastUsedAt |
principal_id | text | false | reference | credential.principal |
revoked_at | timestamp | true | attribute | credential.revokedAt |
status | text | false | attribute | credential.status |
CREATE TABLE IF NOT EXISTS "credential" (
"credential_id" VARCHAR NOT NULL PRIMARY KEY,
"credential_kind_code" VARCHAR NOT NULL,
"status" VARCHAR NOT NULL,
"label" VARCHAR,
"created_at" TIMESTAMPTZ NOT NULL,
"last_used_at" TIMESTAMPTZ,
"revoked_at" TIMESTAMPTZ,
"principal_id" VARCHAR NOT NULL,
CONSTRAINT "credential_credential_kind_code_fk" FOREIGN KEY ("credential_kind_code") REFERENCES "credential_kind" ("code"),
CONSTRAINT "credential_principal_id_fk" FOREIGN KEY ("principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "credential_status_ck" CHECK ("status" IN ('active', 'revoked', 'expired'))
);CREATE TABLE IF NOT EXISTS "credential" (
"credential_id" TEXT NOT NULL PRIMARY KEY,
"credential_kind_code" TEXT NOT NULL,
"status" TEXT NOT NULL,
"label" TEXT,
"created_at" TIMESTAMPTZ NOT NULL,
"last_used_at" TIMESTAMPTZ,
"revoked_at" TIMESTAMPTZ,
"principal_id" TEXT NOT NULL,
CONSTRAINT "credential_credential_kind_code_fk" FOREIGN KEY ("credential_kind_code") REFERENCES "credential_kind" ("code"),
CONSTRAINT "credential_principal_id_fk" FOREIGN KEY ("principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "credential_status_ck" CHECK ("status" IN ('active', 'revoked', 'expired'))
);CREATE TABLE IF NOT EXISTS "credential" (
"credential_id" TEXT NOT NULL PRIMARY KEY,
"credential_kind_code" TEXT NOT NULL,
"status" TEXT NOT NULL,
"label" TEXT,
"created_at" TEXT NOT NULL,
"last_used_at" TEXT,
"revoked_at" TEXT,
"principal_id" TEXT NOT NULL,
CONSTRAINT "credential_credential_kind_code_fk" FOREIGN KEY ("credential_kind_code") REFERENCES "credential_kind" ("code"),
CONSTRAINT "credential_principal_id_fk" FOREIGN KEY ("principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "credential_status_ck" CHECK ("status" IN ('active', 'revoked', 'expired'))
);Read and written from TypeScript with the types the model gives: import { credential } 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 { credential } from "@intellectual-frontiers/data/sql/typed/models";
const rows = await from(credential).select((s) => ({ credentialId: s.credential.credentialId, credentialKindCode: s.credential.credentialKindCode })).run(runner);