native_query_snippet


Description

{“what”:“A stored native SQL query snippet with metadata for reuse and management.”,“why”:“Without it, there is no way to persist and retrieve reusable query fragments.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:04:56.955693692+00:00”}

Columns

Column Type Size Nulls Auto Default Children Parents Comments
id int4 10 √ null

{“what”:“Unique integer identifier for a snippet; primary key.”,“why”:“Without it, snippets cannot be uniquely referenced or joined.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:04:56.987503726+00:00”}

name varchar 254 null

{“what”:“Human-readable label for the snippet; used in lists and search.”,“why”:“Without it, users cannot identify or select a snippet by name.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:04:57.016844495+00:00”}

description text 2147483647 √ null

{“what”:“Free-form text describing the snippet’s purpose or usage.”,“why”:“Without it, the snippet’s intent is undocumented, making reuse risky.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:04:57.041448525+00:00”}

content text 2147483647 null

{“what”:“The exact query text to execute; typically SQL.”,“why”:“Without it, the snippet has no executable logic.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:04:57.064877576+00:00”}

creator_id int4 10 null
core_user.id fk_snippet_creator_id C

{“what”:“User ID of the person who created this snippet.”,“why”:“Without it, ownership and audit trail for the snippet are unknown.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:04:57.095832086+00:00”}

archived bool 1 false

{“what”:“Flag indicating whether the snippet is hidden from active use; true means archived.”,“why”:“Without it, obsolete snippets cannot be hidden without deletion.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:04:57.110628114+00:00”}

created_at timestamptz 35,6 now()

{“what”:“Creation timestamp with timezone; set automatically to now.”,“why”:“Without it, there is no record of when the snippet was added.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:04:57.128972325+00:00”}

updated_at timestamptz 35,6 now()

{“what”:“Last modification timestamp with timezone; updated on each change.”,“why”:“Without it, there is no way to know if a snippet is stale or to sort by recent activity.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:04:57.145222766+00:00”}

collection_id int4 10 √ null
collection.id fk_snippet_collection_id N

{“what”:“ID of the collection this snippet belongs to; null if unassigned.”,“why”:“Without it, snippets cannot be grouped or filtered by collection.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:04:57.168606133+00:00”}

entity_id bpchar 21 √ null

{“what”:“Optional single-character code referencing an external entity; exact meaning not defined in schema.”,“why”:“Without it, the link to an external entity is unknown; schema does not clarify its purpose.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:04:57.188217834+00:00”}

template_tags text 2147483647 √ null

{“what”:“Free-form text containing tags for the snippet, e.g., comma-separated keywords.”,“why”:“Without it, snippets cannot be categorized or searched by tags.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:04:57.209087790+00:00”}

dependency_analysis_version int2 5 0

{“what”:“Version number of the dependency analysis performed on this snippet; 0 means none.”,“why”:“Without it, it is unknown whether the snippet’s dependencies have been analyzed or if the analysis is outdated.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:04:57.239451187+00:00”}

Indexes

Constraint Name Type Sort Column(s)
native_query_snippet_pkey Primary key Asc id
idx_native_query_snippet_creator_id Performance Asc creator_id
idx_native_query_snippet_dependency_analysis_version Performance Asc dependency_analysis_version
idx_snippet_collection_id Performance Asc collection_id
idx_snippet_name Performance Asc name
native_query_snippet_entity_id_key Must be unique Asc entity_id
native_query_snippet_name_key Must be unique Asc name

Relationships