Skip to content

uniform_resource

Description

Immutable resource and content information. On multiple executions,
uniform_resource are inserted only if the the content (see unique
index for details). For historical logging, uniform_resource has foreign
key references to both ur_ingest_session and ur_ingest_session_fs_path
tables to indicate which particular session and ingestion path the
resourced was inserted during.

Table Definition
CREATE TABLE "uniform_resource" (
"uniform_resource_id" VARCHAR PRIMARY KEY NOT NULL,
"device_id" VARCHAR NOT NULL,
"ingest_session_id" VARCHAR NOT NULL,
"ingest_fs_path_id" VARCHAR,
"ingest_imap_acct_folder_id" VARCHAR,
"ingest_issue_acct_project_id" VARCHAR,
"uri" TEXT NOT NULL,
"content_digest" TEXT NOT NULL,
"content" BLOB,
"nature" TEXT,
"size_bytes" INTEGER,
"last_modified_at" TIMESTAMPTZ,
"content_fm_body_attrs" TEXT CHECK(json_valid(content_fm_body_attrs) OR content_fm_body_attrs IS NULL),
"frontmatter" TEXT CHECK(json_valid(frontmatter) OR frontmatter IS NULL),
"elaboration" TEXT CHECK(json_valid(elaboration) OR elaboration IS NULL),
"created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
"created_by" TEXT DEFAULT 'UNKNOWN',
"updated_at" TIMESTAMPTZ,
"updated_by" TEXT,
"deleted_at" TIMESTAMPTZ,
"deleted_by" TEXT,
"activity_log" TEXT,
FOREIGN KEY("device_id") REFERENCES "device"("device_id"),
FOREIGN KEY("ingest_session_id") REFERENCES "ur_ingest_session"("ur_ingest_session_id"),
FOREIGN KEY("ingest_fs_path_id") REFERENCES "ur_ingest_session_fs_path"("ur_ingest_session_fs_path_id"),
FOREIGN KEY("ingest_imap_acct_folder_id") REFERENCES "ur_ingest_session_imap_acct_folder"("ur_ingest_session_imap_acct_folder_id"),
FOREIGN KEY("ingest_issue_acct_project_id") REFERENCES "ur_ingest_session_plm_acct_project"("ur_ingest_session_plm_acct_project_id"),
UNIQUE("device_id", "content_digest", "uri", "size_bytes", "last_modified_at")
)

Columns

NameTypeDefaultNullableChildrenParentsComment
uniform_resource_idVARCHARfalseuniform_resource_transform ur_ingest_session_fs_path_entry ur_ingest_session_task ur_ingest_session_imap_acct_folder_message ur_ingest_session_plm_acct_project_issue ur_ingest_session_attachment ur_ingest_session_udi_pgp_sqluniform_resource ULID primary key
device_idVARCHARfalsedevicewhich device row introduced this resource
ingest_session_idVARCHARfalseur_ingest_sessionwhich ur_ingest_session row introduced this resource
ingest_fs_path_idVARCHARtrueur_ingest_session_fs_pathwhich ur_ingest_session_fs_path row introduced this resource
ingest_imap_acct_folder_idVARCHARtrueur_ingest_session_imap_acct_folder{“isSqlDomainZodDescrMeta”:true,“isVarChar”:true}
ingest_issue_acct_project_idVARCHARtrueur_ingest_session_plm_acct_project{“isSqlDomainZodDescrMeta”:true,“isVarChar”:true}
uriTEXTfalsethe resource’s URI (dependent on how it was acquired and on which device)
content_digestTEXTfalse’-’ when no hash was computed (not NULL); content_digest for symlinks will be the same as their target
contentBLOBtrueeither NULL if no content was acquired or the actual blob/text of the content
natureTEXTtruefile extension or MIME
size_bytesINTEGERtrue
last_modified_atTIMESTAMPTZtrue{“isSqlDomainZodDescrMeta”:true,“isDateSqlDomain”:true,“isDateTime”:true}
content_fm_body_attrsTEXTtrueeach component of frontmatter-based content ({ frontMatter: ”, body: ”, attrs: {…} })
frontmatterTEXTtruemeta data or other “frontmatter” in JSON format
elaborationTEXTtrueanything that doesn’t fit in other columns (JSON)
created_atTIMESTAMPTZCURRENT_TIMESTAMPtrue
created_byTEXT’UNKNOWN’true
updated_atTIMESTAMPTZtrue
updated_byTEXTtrue
deleted_atTIMESTAMPTZtrue
deleted_byTEXTtrue
activity_logTEXTtrue{“isSqlDomainZodDescrMeta”:true,“isJsonSqlDomain”:true}

Constraints

NameTypeDefinition
uniform_resource_idPRIMARY KEYPRIMARY KEY (uniform_resource_id)
- (Foreign key ID: 0)FOREIGN KEYFOREIGN KEY (ingest_issue_acct_project_id) REFERENCES ur_ingest_session_plm_acct_project (ur_ingest_session_plm_acct_project_id) ON UPDATE NO ACTION ON DELETE NO ACTION MATCH NONE
- (Foreign key ID: 1)FOREIGN KEYFOREIGN KEY (ingest_imap_acct_folder_id) REFERENCES ur_ingest_session_imap_acct_folder (ur_ingest_session_imap_acct_folder_id) ON UPDATE NO ACTION ON DELETE NO ACTION MATCH NONE
- (Foreign key ID: 2)FOREIGN KEYFOREIGN KEY (ingest_fs_path_id) REFERENCES ur_ingest_session_fs_path (ur_ingest_session_fs_path_id) ON UPDATE NO ACTION ON DELETE NO ACTION MATCH NONE
- (Foreign key ID: 3)FOREIGN KEYFOREIGN KEY (ingest_session_id) REFERENCES ur_ingest_session (ur_ingest_session_id) ON UPDATE NO ACTION ON DELETE NO ACTION MATCH NONE
- (Foreign key ID: 4)FOREIGN KEYFOREIGN KEY (device_id) REFERENCES device (device_id) ON UPDATE NO ACTION ON DELETE NO ACTION MATCH NONE
sqlite_autoindex_uniform_resource_2UNIQUEUNIQUE (device_id, content_digest, uri, size_bytes, last_modified_at)
sqlite_autoindex_uniform_resource_1PRIMARY KEYPRIMARY KEY (uniform_resource_id)
-CHECKCHECK(json_valid(content_fm_body_attrs) OR content_fm_body_attrs IS NULL)
-CHECKCHECK(json_valid(frontmatter) OR frontmatter IS NULL)
-CHECKCHECK(json_valid(elaboration) OR elaboration IS NULL)

Indexes

NameDefinition
idx_uniform_resource__device_id__uriCREATE INDEX “idx_uniform_resource__device_id__uri” ON “uniform_resource”(“device_id”, “uri”)
sqlite_autoindex_uniform_resource_2UNIQUE (device_id, content_digest, uri, size_bytes, last_modified_at)
sqlite_autoindex_uniform_resource_1PRIMARY KEY (uniform_resource_id)

Relations

er