IF Commons GitHub

resourceAttribute

concept

A value of an attribute for a resource

Model identityAbac. Written in commons/data/models/identity-abac/mod.ts:71. Identified by resourceAttributeId.

Governance: attributes

resourceAttributeIdidentifierrequired

What identifies the value, made by the application

Becomes the column resource_attribute_id of resource_attribute.

Written at commons/data/models/identity-abac/mod.ts:74

resourceIdtextrequired

The resource

Becomes the column resource_id of resource_attribute.

Written at commons/data/models/identity-abac/mod.ts:76

resourceTypetextrequired

The kind of resource

Becomes the column resource_type of resource_attribute.

Written at commons/data/models/identity-abac/mod.ts:75

updatedAtinstantrequired

When it was last asserted

Becomes the column updated_at of resource_attribute.

Written at commons/data/models/identity-abac/mod.ts:78

valuestructuredrequired

The value, of the type the definition says

Becomes the column value of resource_attribute.

Written at commons/data/models/identity-abac/mod.ts:77

valueKeytextrequired

A hash of the tenant, the resource and the attribute, unique, so that a resource has one value of an attribute

Becomes the column value_key of resource_attribute.

Written at commons/data/models/identity-abac/mod.ts:79

Governance: relationships

definitionone

The attribute To attributeDefinition. Written at commons/data/models/identity-abac/mod.ts:72

tenantone

The tenant the resource is in To tenant. Written at commons/data/models/identity-abac/mod.ts:109

Logical: the table

Projects to the table resource_attribute with the primary key resource_attribute_id.

ColumnTypeNullRoleFrom
definition_attribute_definition_idtextfalsereferenceresourceAttribute.definition
resource_attribute_idtextfalseattributeresourceAttribute.resourceAttributeId
resource_idtextfalseattributeresourceAttribute.resourceId
resource_typetextfalseattributeresourceAttribute.resourceType
tenant_idtextfalsereferenceresourceAttribute.tenant
updated_attimestampfalseattributeresourceAttribute.updatedAt
valuejsonfalseattributeresourceAttribute.value
value_keytextfalseattributeresourceAttribute.valueKey

Physical: SQL

CREATE TABLE IF NOT EXISTS "resource_attribute" (
    "resource_attribute_id" VARCHAR NOT NULL PRIMARY KEY,
    "resource_type" VARCHAR NOT NULL,
    "resource_id" VARCHAR NOT NULL,
    "value" JSON NOT NULL,
    "updated_at" TIMESTAMPTZ NOT NULL,
    "value_key" VARCHAR NOT NULL,
    "tenant_id" VARCHAR NOT NULL,
    "definition_attribute_definition_id" VARCHAR NOT NULL,
    CONSTRAINT "resource_attribute_tenant_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "tenant" ("tenant_id"),
    CONSTRAINT "resource_attribute_definition_attribute_definition_id_fk" FOREIGN KEY ("definition_attribute_definition_id") REFERENCES "attribute_definition" ("attribute_definition_id"),
    CONSTRAINT "resource_attribute_value_key_uq" UNIQUE ("value_key")
);

Physical: the typed table

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

const rows = await from(resourceAttribute).select((s) => ({ resourceAttributeId: s.resourceAttribute.resourceAttributeId, resourceType: s.resourceAttribute.resourceType })).run(runner);

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