Tearleads

organization_read_model_container_grants Client SQLite table

Whole-lane container grants used only by organization presentation reads.

Declared in packages/client-sdk/src/data/sqlite/schema/organizationReadModelSchema.ts

Columns

  • organization_idtext
    • not null

    Organization that owns the container.

  • container_idtext
    • not null

    Container the grant applies to.

  • subject_typetext
    • not null

    Grant subject kind: user or group.

  • subject_idtext
    • not null

    Id of the granted user or group.

  • sort_orderinteger
    • not null

    Zero-based position in the served grants list; reads sort by it.

  • access_leveltext
    • not null

    Granted access: read, write, or admin.

  • created_attext
    • not null

    ISO-8601 creation time of the container.

  • depthinteger
    • not null

    The container's distance from its root container; roots are 0.

  • is_builtininteger
    • not null

    True for a built-in grant: Admins on the organization's root container, or Admins or Members on its metadata container.

  • metadata_access_epochinteger
    • not null

    Epoch of the container's current access manifest.

  • metadata_access_state_hashtext
    • not null

    Content hash of the container's current access manifest.

  • metadata_document_idtext
    • nullable

    Id of the container's metadata document named by that manifest; null when it names none.

  • parent_idtext
    • nullable

    Parent container id; null for a root container.

  • updated_attext
    • not null

    ISO-8601 time the container's access manifest head last changed.

  • user_idtext
    • nullable

    The granted user's id for a user subject; null for a group.

  • signing_key_fingerprinttext
    • nullable

    Hex SHA-256 fingerprint of the granted user's root signing public key; null for a group, or when the server knows no such user.

  • group_idtext
    • nullable

    The granted group's id for a group subject; null for a user.

Keys and constraints

  • Primary key(organization_id, container_id, subject_type, subject_id)

DDL

The statements the client runs to create this table and its indexes.

CREATE TABLE IF NOT EXISTS "organization_read_model_container_grants" (
  "organization_id" TEXT NOT NULL,
  "container_id" TEXT NOT NULL,
  "subject_type" TEXT NOT NULL,
  "subject_id" TEXT NOT NULL,
  "sort_order" INTEGER NOT NULL,
  "access_level" TEXT NOT NULL,
  "created_at" TEXT NOT NULL,
  "depth" INTEGER NOT NULL,
  "is_builtin" INTEGER NOT NULL,
  "metadata_access_epoch" INTEGER NOT NULL,
  "metadata_access_state_hash" TEXT NOT NULL,
  "metadata_document_id" TEXT,
  "parent_id" TEXT,
  "updated_at" TEXT NOT NULL,
  "user_id" TEXT,
  "signing_key_fingerprint" TEXT,
  "group_id" TEXT,
  PRIMARY KEY ("organization_id", "container_id", "subject_type", "subject_id")
);