updatedAtinstantrequiredWhen it was last asserted
Becomes the column updated_at of principal_attribute.
Written at commons/data/models/identity-abac/mod.ts:59
A value of an attribute for a principal of any kind
Model identityAbac. Written in commons/data/models/identity-abac/mod.ts:53. Identified by principal, definition.
updatedAtinstantrequiredWhen it was last asserted
Becomes the column updated_at of principal_attribute.
Written at commons/data/models/identity-abac/mod.ts:59
validFrominstantrequiredWhen the value starts to hold
Becomes the column valid_from of principal_attribute.
Written at commons/data/models/identity-abac/mod.ts:57
validToinstantoptionalWhen it stops, where it does
Becomes the column valid_to of principal_attribute.
Written at commons/data/models/identity-abac/mod.ts:58
valuestructuredrequiredThe value, of the type the definition says
Becomes the column value of principal_attribute.
Written at commons/data/models/identity-abac/mod.ts:56
assertedByoptionalWho asserted it, where a principal did To principal. Written at commons/data/models/identity-abac/mod.ts:65
definitiononeThe attribute To attributeDefinition. Written at commons/data/models/identity-abac/mod.ts:54
principaloneThe principal To principal. Written at commons/data/models/identity-abac/mod.ts:63
Projects to the table principal_attribute with the primary key principal_id, definition_attribute_definition_id.
| Column | Type | Null | Role | From |
|---|---|---|---|---|
asserted_by_principal_id | text | true | reference | principalAttribute.assertedBy |
definition_attribute_definition_id | text | false | reference | principalAttribute.definition |
principal_id | text | false | reference | principalAttribute.principal |
updated_at | timestamp | false | attribute | principalAttribute.updatedAt |
valid_from | timestamp | false | attribute | principalAttribute.validFrom |
valid_to | timestamp | true | attribute | principalAttribute.validTo |
value | json | false | attribute | principalAttribute.value |
CREATE TABLE IF NOT EXISTS "principal_attribute" (
"principal_id" VARCHAR NOT NULL,
"definition_attribute_definition_id" VARCHAR NOT NULL,
"value" JSON NOT NULL,
"valid_from" TIMESTAMPTZ NOT NULL,
"valid_to" TIMESTAMPTZ,
"updated_at" TIMESTAMPTZ NOT NULL,
"asserted_by_principal_id" VARCHAR,
PRIMARY KEY ("principal_id", "definition_attribute_definition_id"),
CONSTRAINT "principal_attribute_principal_id_fk" FOREIGN KEY ("principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "principal_attribute_definition_attribute_definition_id_fk" FOREIGN KEY ("definition_attribute_definition_id") REFERENCES "attribute_definition" ("attribute_definition_id"),
CONSTRAINT "principal_attribute_asserted_by_principal_id_fk" FOREIGN KEY ("asserted_by_principal_id") REFERENCES "principal" ("principal_id")
);CREATE TABLE IF NOT EXISTS "principal_attribute" (
"principal_id" TEXT NOT NULL,
"definition_attribute_definition_id" TEXT NOT NULL,
"value" JSONB NOT NULL,
"valid_from" TIMESTAMPTZ NOT NULL,
"valid_to" TIMESTAMPTZ,
"updated_at" TIMESTAMPTZ NOT NULL,
"asserted_by_principal_id" TEXT,
PRIMARY KEY ("principal_id", "definition_attribute_definition_id"),
CONSTRAINT "principal_attribute_principal_id_fk" FOREIGN KEY ("principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "principal_attribute_definition_attribute_definition_id_fk" FOREIGN KEY ("definition_attribute_definition_id") REFERENCES "attribute_definition" ("attribute_definition_id"),
CONSTRAINT "principal_attribute_asserted_by_principal_id_fk" FOREIGN KEY ("asserted_by_principal_id") REFERENCES "principal" ("principal_id")
);CREATE TABLE IF NOT EXISTS "principal_attribute" (
"principal_id" TEXT NOT NULL,
"definition_attribute_definition_id" TEXT NOT NULL,
"value" TEXT NOT NULL,
"valid_from" TEXT NOT NULL,
"valid_to" TEXT,
"updated_at" TEXT NOT NULL,
"asserted_by_principal_id" TEXT,
PRIMARY KEY ("principal_id", "definition_attribute_definition_id"),
CONSTRAINT "principal_attribute_principal_id_fk" FOREIGN KEY ("principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "principal_attribute_definition_attribute_definition_id_fk" FOREIGN KEY ("definition_attribute_definition_id") REFERENCES "attribute_definition" ("attribute_definition_id"),
CONSTRAINT "principal_attribute_asserted_by_principal_id_fk" FOREIGN KEY ("asserted_by_principal_id") REFERENCES "principal" ("principal_id")
);Read and written from TypeScript with the types the model gives: import { principalAttribute } from "@intellectual-frontiers/data/sql/typed/models". Generated in commons/data/sql/typed/models/identity-abac.auto.ts: do not edit.
import { from } from "@intellectual-frontiers/data/sql/typed";
import { principalAttribute } from "@intellectual-frontiers/data/sql/typed/models";
const rows = await from(principalAttribute).select((s) => ({ principalId: s.principalAttribute.principalId, definitionAttributeDefinitionId: s.principalAttribute.definitionAttributeDefinitionId })).run(runner);