> For the complete documentation index, see [llms.txt](https://docs.snapfix.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.snapfix.com/engineering-reference/db/tables/viewpoint-2.md).

# Tasks tables

{% hint style="info" %}
Generated from the staging database schema, with descriptions drafted by agents ([how to read these docs](https://docs.snapfix.com/how-to-read.md)). [Source on GitHub](https://github.com/snapfix/docs/blob/main/spec/db/tables/viewpoint-2.md).
{% endhint %}

## Description

Tasks (`tPri_Job`): statuses and their history, assignees and followers, tags on tasks, time and cost, task links, view logs, the shared task page, and the task type and origin codes.

## Tables

| Name                                                                                                                     | Columns | Comment                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | Type       |
| ------------------------------------------------------------------------------------------------------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| [enum\_JobType](https://docs.snapfix.com/engineering-reference/db/tables/enum_jobtype.md)                                | 10      | Task types: the code in uuid, which tPri\_Job.enum\_JobType holds, with a name and a report name, for example 0 normal (mobile app task) and 1 planned (scheduled task); 27 rows. No code reads the table \[[ASK-246](https://github.com/snapfix/docs/blob/main/ASK.md#ask-246-should-the-enum-lookup-tables-follow-the-code-or-be-retired)]. Codes 45 (cleaning task) and 46 (inspection task) of the app's JobType enum have no row \[[ASK-246](https://github.com/snapfix/docs/blob/main/ASK.md#ask-246-should-the-enum-lookup-tables-follow-the-code-or-be-retired)]. | BASE TABLE |
| [enum\_Origin](https://docs.snapfix.com/engineering-reference/db/tables/enum_origin.md)                                  | 10      | Where a task was made: the code in uuid, which tPri\_Job.enum\_Origin holds, from 0 to 10 (unknown, android, ios, web, web-admin, email, qr, publicapi, guestline, schedule and auto-hk). No code reads the table \[[ASK-246](https://github.com/snapfix/docs/blob/main/ASK.md#ask-246-should-the-enum-lookup-tables-follow-the-code-or-be-retired)]. Code 11 (xvendor) has no row.                                                                                                                                                                                       | BASE TABLE |
| [list\_TaskImageUrl](https://docs.snapfix.com/engineering-reference/db/tables/list_taskimageurl.md)                      | 9       | One sample image URL that the random test task generators (apipy POST /v4/random-jobs and api\_php\_live\_v2's admin random task endpoint) pick from; no row is newer than 2022-12.                                                                                                                                                                                                                                                                                                                                                                                       | BASE TABLE |
| [list\_TaskTitle](https://docs.snapfix.com/engineering-reference/db/tables/list_tasktitle.md)                            | 9       | One sample task title that the random test task generators (apipy POST /v4/random-jobs and api\_php\_live\_v2's admin random task endpoint) pick from; no row is newer than 2022-12.                                                                                                                                                                                                                                                                                                                                                                                      | BASE TABLE |
| [tPri\_BusinessTagHeaderRule](https://docs.snapfix.com/engineering-reference/db/tables/tpri_businesstagheaderrule.md)    | 14      | One group's rule for one tag folder (tPri\_TagHeader): whether the folder is excluded from the group or mandatory for its tasks.                                                                                                                                                                                                                                                                                                                                                                                                                                          | BASE TABLE |
| [tPri\_Job](https://docs.snapfix.com/engineering-reference/db/tables/tpri_job.md)                                        | 90      | One task (UI: task) in a group, with its title, status colour, people, rooms, dates, priority and approval state; most task tables point to it. An asset is a task in an asset register.                                                                                                                                                                                                                                                                                                                                                                                  | BASE TABLE |
| [tPri\_JobAttribute](https://docs.snapfix.com/engineering-reference/db/tables/tpri_jobattribute.md)                      | 23      | The value of one attribute (name, category, key and value) on one asset or task, following the register's attribute rule (tPri\_BusinessJobAttributeRule).                                                                                                                                                                                                                                                                                                                                                                                                                | BASE TABLE |
| [tPri\_JobJobLink](https://docs.snapfix.com/engineering-reference/db/tables/tpri_jobjoblink.md)                          | 15      | Links a task (uuid\_tJob\_a) to an asset (uuid\_tJob\_b), with the group of each; all but 9 staging rows are task-to-asset links.                                                                                                                                                                                                                                                                                                                                                                                                                                         | BASE TABLE |
| [tPri\_JobLink](https://docs.snapfix.com/engineering-reference/db/tables/tpri_joblink.md)                                | 15      | Links a master task to a tagged task, which may be in another group; housekeeping uses it to pair a cleaning task with its inspection task.                                                                                                                                                                                                                                                                                                                                                                                                                               | BASE TABLE |
| [tPri\_JobTag](https://docs.snapfix.com/engineering-reference/db/tables/tpri_jobtag.md)                                  | 16      | A tag on a task, one row per task and tag, set by hand or suggested by Snapfix Recommends (aiSuggested); aiNewTag marks a suggested new tag.                                                                                                                                                                                                                                                                                                                                                                                                                              | BASE TABLE |
| [tPri\_JobTag\_Log](https://docs.snapfix.com/engineering-reference/db/tables/tpri_jobtag_log.md)                         | 10      | One task tag change made by a tag folder merge (web account settings, Manage tags), with the old and new tag and folder, so that an admin can undo the merge.                                                                                                                                                                                                                                                                                                                                                                                                             | BASE TABLE |
| [tPri\_JobTimeCost](https://docs.snapfix.com/engineering-reference/db/tables/tpri_jobtimecost.md)                        | 21      | A time or cost entry on a task: a title, description and user, with a duration or an amount in a currency.                                                                                                                                                                                                                                                                                                                                                                                                                                                                | BASE TABLE |
| [tPri\_JobUser](https://docs.snapfix.com/engineering-reference/db/tables/tpri_jobuser.md)                                | 15      | A group member who follows a task (UI: "Followed by"), with the soft-freeze flag; the creator is added as a follower.                                                                                                                                                                                                                                                                                                                                                                                                                                                     | BASE TABLE |
| [tPri\_JobUserAssigned](https://docs.snapfix.com/engineering-reference/db/tables/tpri_jobuserassigned.md)                | 16      | A user assigned to a task (UI: "Assigned to"), with the AI-suggestion flag; removing an assignment soft-deletes the row.                                                                                                                                                                                                                                                                                                                                                                                                                                                  | BASE TABLE |
| [tPri\_Job\_StatusLog](https://docs.snapfix.com/engineering-reference/db/tables/tpri_job_statuslog.md)                   | 10      | One status change of a task: the colour, approval status, notes and the time the status took effect.                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | BASE TABLE |
| [tPri\_Log\_BusinessViewedUser](https://docs.snapfix.com/engineering-reference/db/tables/tpri_log_businessvieweduser.md) | 8       | A row each time a user opens a group; the updates feed reads the newest one.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | BASE TABLE |
| [tPri\_Log\_Job](https://docs.snapfix.com/engineering-reference/db/tables/tpri_log_job.md)                               | 10      | A change record for a task: the verb, the new values and the task before the change. Only php-apis's voice task auto-fill writes it; the newest row is from 2023-05.                                                                                                                                                                                                                                                                                                                                                                                                      | BASE TABLE |
| [tPri\_Log\_JobViewedUser](https://docs.snapfix.com/engineering-reference/db/tables/tpri_log_jobvieweduser.md)           | 9       | A row each time a user opens a task; the unread filters compare it with the task's changes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | BASE TABLE |
| [tPri\_Status](https://docs.snapfix.com/engineering-reference/db/tables/tpri_status.md)                                  | 13      | A group's own name for a task status, with its sort order. Tasks link to it with uuid\_tStatus.                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | BASE TABLE |
| [tPri\_StatusSub](https://docs.snapfix.com/engineering-reference/db/tables/tpri_statussub.md)                            | 13      | A group's sub-status name, with its sort order. Tasks link to it with uuid\_tStatusSub.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | BASE TABLE |
| [tPri\_Tag](https://docs.snapfix.com/engineering-reference/db/tables/tpri_tag.md)                                        | 16      | A tag in a group's tag folder (tPri\_TagHeader); tasks carry tags from this list.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | BASE TABLE |
| [tPri\_TagHeader](https://docs.snapfix.com/engineering-reference/db/tables/tpri_tagheader.md)                            | 17      | A tag folder of a group, such as Location, Equipment or Category, with name, description, icon and sort order. Its tags are rows in tPri\_Tag.                                                                                                                                                                                                                                                                                                                                                                                                                            | BASE TABLE |
| [tPub\_Status](https://docs.snapfix.com/engineering-reference/db/tables/tpub_status.md)                                  | 4       | Default task statuses, Red, Amber and Green, plus test rows. Only php-apis's uncalled save\_new\_business copies them into a new group; the group creation in use sets Red, Amber and Green itself.                                                                                                                                                                                                                                                                                                                                                                       | BASE TABLE |
| [tPub\_StatusSub](https://docs.snapfix.com/engineering-reference/db/tables/tpub_statussub.md)                            | 4       | Default sub-statuses, New, In Progress and Closed, plus test rows. Only php-apis's uncalled save\_new\_business copies them into a new group.                                                                                                                                                                                                                                                                                                                                                                                                                             | BASE TABLE |
| [tPub\_TagDefault](https://docs.snapfix.com/engineering-reference/db/tables/tpub_tagdefault.md)                          | 4       | Default tags, each under a default tag folder (uuid\_tTagHeaderDefault). php-apis's copy into new groups is commented out \[[ASK-252](https://github.com/snapfix/docs/blob/main/ASK.md#ask-252-should-new-groups-start-with-the-default-tag-folders)].                                                                                                                                                                                                                                                                                                                    | BASE TABLE |
| [tPub\_TagHeaderDefault](https://docs.snapfix.com/engineering-reference/db/tables/tpub_tagheaderdefault.md)              | 4       | Default tag folders, Location, Equipment and Category. php-apis's copy into new groups is commented out \[[ASK-252](https://github.com/snapfix/docs/blob/main/ASK.md#ask-252-should-new-groups-start-with-the-default-tag-folders)].                                                                                                                                                                                                                                                                                                                                      | BASE TABLE |
| [url\_job\_token](https://docs.snapfix.com/engineering-reference/db/tables/url_job_token.md)                             | 15      | A share link to one task (uuid\_tJob) that opens it read-only until it expires. The Laravel task sharing, the QR form backend (authpy) and php-apis create them.                                                                                                                                                                                                                                                                                                                                                                                                          | BASE TABLE |

## Relations

```mermaid
erDiagram

"tPri_JobTag" }o--o| "tPri_Job" : "FOREIGN KEY (uuid_tJob) REFERENCES tPri_Job (uuid)"
"tPri_JobTag" }o--o| "tPri_Tag" : "FOREIGN KEY (uuid_tTag) REFERENCES tPri_Tag (uuid)"
"tPri_JobTimeCost" }o--o| "tPri_Job" : "FOREIGN KEY (uuid_tJob) REFERENCES tPri_Job (uuid)"
"tPri_JobUser" }o--o| "tPri_Job" : "FOREIGN KEY (uuid_tJob) REFERENCES tPri_Job (uuid)"
"tPri_JobUserAssigned" }o--o| "tPri_Job" : "FOREIGN KEY (uuid_tJob) REFERENCES tPri_Job (uuid)"
"tPri_Log_Job" }o--o| "tPri_Job" : "FOREIGN KEY (uuid_tJob) REFERENCES tPri_Job (uuid)"
"tPri_Tag" }o--o| "tPri_TagHeader" : "FOREIGN KEY (uuid_tTagHeader) REFERENCES tPri_TagHeader (uuid)"
"url_job_token" }o--o| "tPri_Job" : "FOREIGN KEY (uuid_tJob) REFERENCES tPri_Job (uuid)"

"enum_JobType" {
}
"enum_Origin" {
}
"list_TaskImageUrl" {
}
"list_TaskTitle" {
}
"tPri_BusinessTagHeaderRule" {
}
"tPri_Job" {
  varchar_255_ uuid
}
"tPri_JobAttribute" {
}
"tPri_JobJobLink" {
}
"tPri_JobLink" {
}
"tPri_JobTag" {
  varchar_255_ uuid_tJob
  varchar_255_ uuid_tTag
}
"tPri_JobTag_Log" {
}
"tPri_JobTimeCost" {
  varchar_255_ uuid_tJob
}
"tPri_JobUser" {
  varchar_255_ uuid_tJob
}
"tPri_JobUserAssigned" {
  varchar_255_ uuid_tJob
}
"tPri_Job_StatusLog" {
}
"tPri_Log_BusinessViewedUser" {
}
"tPri_Log_Job" {
  varchar_255_ uuid_tJob
}
"tPri_Log_JobViewedUser" {
}
"tPri_Status" {
}
"tPri_StatusSub" {
}
"tPri_Tag" {
  varchar_255_ uuid
  varchar_255_ uuid_tTagHeader
}
"tPri_TagHeader" {
  varchar_255_ uuid
}
"tPub_Status" {
}
"tPub_StatusSub" {
}
"tPub_TagDefault" {
}
"tPub_TagHeaderDefault" {
}
"url_job_token" {
  varchar_255_ uuid_tJob
}
```

***

> Generated by [tbls](https://github.com/k1LoW/tbls)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.snapfix.com/engineering-reference/db/tables/viewpoint-2.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
