CREATE TABLE `uniform_resource` (
`uniform_resource_id` text PRIMARY KEY NOT NULL,
`device_id` text NOT NULL,
`ingest_session_id` text NOT NULL,
`ingest_fs_path_id` text,
`ingest_session_imap_acct_folder_message` text,
`ingest_issue_acct_project_id` text,
`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,
`frontmatter` text,
`elaboration` text,
`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`) ON UPDATE no action ON DELETE no action,
FOREIGN KEY (`ingest_session_id`) REFERENCES `ur_ingest_session`(`ur_ingest_session_id`) ON UPDATE no action ON DELETE no action,
FOREIGN 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,
FOREIGN KEY (`ingest_session_imap_acct_folder_message`) REFERENCES `ur_ingest_session_imap_acct_folder_message`(`ur_ingest_session_imap_acct_folder_message_id`) ON UPDATE no action ON DELETE no action,
FOREIGN 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,
CONSTRAINT "content_fm_body_attrs_check_valid_json" CHECK(json_valid("uniform_resource"."content_fm_body_attrs") OR "uniform_resource"."content_fm_body_attrs" IS NULL),
CONSTRAINT "frontmatter_check_valid_json" CHECK(json_valid("uniform_resource"."frontmatter") OR "uniform_resource"."frontmatter" IS NULL),
CONSTRAINT "elaboration_check_valid_json" CHECK(json_valid("uniform_resource"."elaboration") OR "uniform_resource"."elaboration" IS NULL)
)