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,
"uri" TEXT NOT NULL,
"content_digest" TEXT NOT NULL,
"content" BLOB,
"nature" TEXT,
"size_bytes" INTEGER,
"last_modified_at" TIMESTAMP,
"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" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
"created_by" TEXT DEFAULT 'UNKNOWN',
"updated_at" TIMESTAMP,
"updated_by" TEXT,
"deleted_at" TIMESTAMP,
"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"),
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_taskuniform_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
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_atTIMESTAMPtrue{“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_atTIMESTAMPCURRENT_TIMESTAMPtrue
created_byTEXT’UNKNOWN’true
updated_atTIMESTAMPtrue
updated_byTEXTtrue
deleted_atTIMESTAMPtrue
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_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: 1)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: 2)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_resourcedevice_iduriCREATE INDEX “idx_uniform_resourcedevice_iduri” 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