> 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-7.md).

# Rooms 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-7.md).
{% endhint %}

## Description

Buildings, sections, areas and rooms, room statuses, guests and beds, the users linked to rooms and areas, and their logs.

## Tables

| Name                                                                                                                              | Columns | Comment                                                                                                                                                                                                                                                                                                                                                                                                          | Type       |
| --------------------------------------------------------------------------------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| [tPri\_Area](https://docs.snapfix.com/engineering-reference/db/tables/tpri_area.md)                                               | 31      | An area of a site's building, with its name, description, instructions, priority and map position.                                                                                                                                                                                                                                                                                                               | BASE TABLE |
| [tPri\_AreaUser](https://docs.snapfix.com/engineering-reference/db/tables/tpri_areauser.md)                                       | 15      | Links a user to an area with active, archived and visible flags. Empty on staging; php-apis still has its save action and sends it in the app sync.                                                                                                                                                                                                                                                              | BASE TABLE |
| [tPri\_AreaUserAssigned](https://docs.snapfix.com/engineering-reference/db/tables/tpri_areauserassigned.md)                       | 13      | A user assigned to an area. Empty on staging; php-apis still has its save action and sends it in the app sync.                                                                                                                                                                                                                                                                                                   | BASE TABLE |
| [tPri\_Building](https://docs.snapfix.com/engineering-reference/db/tables/tpri_building.md)                                       | 22      | A building of a site, with its type, address and the switch for manual room status; rooms, areas and the room status lists belong to a building.                                                                                                                                                                                                                                                                 | BASE TABLE |
| [tPri\_BuildingRoomSection](https://docs.snapfix.com/engineering-reference/db/tables/tpri_buildingroomsection.md)                 | 15      | A section of a building's room status catalogue; the main and secondary room statuses each point to one section.                                                                                                                                                                                                                                                                                                 | BASE TABLE |
| [tPri\_BuildingRoomStatus](https://docs.snapfix.com/engineering-reference/db/tables/tpri_buildingroomstatus.md)                   | 16      | Unused: an earlier room status list, from before the main and secondary lists. Empty on staging; php-apis's code for it is commented out and the Laravel API's model for it is never used.                                                                                                                                                                                                                       | BASE TABLE |
| [tPri\_BuildingRoomStatusMain](https://docs.snapfix.com/engineering-reference/db/tables/tpri_buildingroomstatusmain.md)           | 18      | A main room status of a building (UI: room status), with its colour, description and section. A room has one main status and may have secondary ones; PMS integrations map their own statuses to these rows.                                                                                                                                                                                                     | BASE TABLE |
| [tPri\_BuildingRoomStatusSecondary](https://docs.snapfix.com/engineering-reference/db/tables/tpri_buildingroomstatussecondary.md) | 18      | A secondary room status of a building, in a section of the room status catalogue, shown next to the room's main status.                                                                                                                                                                                                                                                                                          | BASE TABLE |
| [tPri\_JobArea](https://docs.snapfix.com/engineering-reference/db/tables/tpri_jobarea.md)                                         | 13      | Links a task to an area (tPri\_Area); aiSuggested marks a link the AI suggested.                                                                                                                                                                                                                                                                                                                                 | BASE TABLE |
| [tPri\_JobRoom](https://docs.snapfix.com/engineering-reference/db/tables/tpri_jobroom.md)                                         | 13      | Links a task to a room (tPri\_Room); aiSuggested marks a link the AI suggested.                                                                                                                                                                                                                                                                                                                                  | BASE TABLE |
| [tPri\_Log\_AreaViewedUser](https://docs.snapfix.com/engineering-reference/db/tables/tpri_log_areavieweduser.md)                  | 8       | A row each time a user opens an area; the count of that area's updates for the user starts from these rows.                                                                                                                                                                                                                                                                                                      | BASE TABLE |
| [tPri\_Log\_RoomStatusChange](https://docs.snapfix.com/engineering-reference/db/tables/tpri_log_roomstatuschange.md)              | 9       | One room status change: the room, its new main and secondary status, and the integration that sent it.                                                                                                                                                                                                                                                                                                           | BASE TABLE |
| [tPri\_Log\_RoomViewedUser](https://docs.snapfix.com/engineering-reference/db/tables/tpri_log_roomvieweduser.md)                  | 8       | A row each time a user opens a room; the updates feed reads the newest one.                                                                                                                                                                                                                                                                                                                                      | BASE TABLE |
| [tPri\_ParentRoomStatus](https://docs.snapfix.com/engineering-reference/db/tables/tpri_parentroomstatus.md)                       | 16      | Unused; empty, and only an unused Laravel model names it (php-apis's sync case for it is commented out). tPri\_Room.uuid\_tParentRoomStatus points here, with no foreign key.                                                                                                                                                                                                                                    | BASE TABLE |
| [tPri\_Room](https://docs.snapfix.com/engineering-reference/db/tables/tpri_room.md)                                               | 57      | One room of a site, in a building, with its status, floor, type, priority, capacity and cleaning times. Housekeeping tasks are created per room.                                                                                                                                                                                                                                                                 | BASE TABLE |
| [tPri\_RoomBed](https://docs.snapfix.com/engineering-reference/db/tables/tpri_roombed.md)                                         | 11      | The beds of one type in a room (fType, fCount). Rows keep arriving, but no in-scope code names the table \[[ASK-243](https://github.com/snapfix/docs/blob/main/ASK.md#ask-243-which-service-writes-the-tables-that-no-in-scope-code-names)].                                                                                                                                                                     | BASE TABLE |
| [tPri\_RoomFeatures](https://docs.snapfix.com/engineering-reference/db/tables/tpri_roomfeatures.md)                               | 10      | The features of one room as a JSON array, one row per room on staging. The Opera room sync writes it, but its insert and update name roomFeatures and fDeletedTs columns that the table lacks \[[ASK-253](https://github.com/snapfix/docs/blob/main/ASK.md#ask-253-which-room-features-column-does-the-opera-sync-write)].                                                                                       | BASE TABLE |
| [tPri\_RoomGuestStatus](https://docs.snapfix.com/engineering-reference/db/tables/tpri_roomgueststatus.md)                         | 27      | One booking of a room, with booking and confirmation references, stay dates, guest counts and status, written by the PMS syncs. The Laravel API and the apps read it.                                                                                                                                                                                                                                            | BASE TABLE |
| [tPri\_RoomGuests](https://docs.snapfix.com/engineering-reference/db/tables/tpri_roomguests.md)                                   | 27      | One guest on a booking (tPri\_RoomGuestStatus), with name, contact and address details and a VIP flag, written by the PMS syncs; the rows hold personal data. Some bookings have more than one live row for the same guest, and how long the rows are kept is open \[[ASK-245](https://github.com/snapfix/docs/blob/main/ASK.md#ask-245-how-long-should-guest-records-and-personal-data-in-log-tables-be-kept)]. | BASE TABLE |
| [tPri\_RoomStatusIcon](https://docs.snapfix.com/engineering-reference/db/tables/tpri_roomstatusicon.md)                           | 15      | An icon (image URL) for a room status, with sort order and visibility. The main and secondary room statuses point to it, the apps download it, and no row is newer than 2025-04.                                                                                                                                                                                                                                 | BASE TABLE |
| [tPri\_RoomUser](https://docs.snapfix.com/engineering-reference/db/tables/tpri_roomuser.md)                                       | 15      | A user linked to a room, with active, archived and visible flags. php-apis's sync reads it and its save action writes it; empty on staging.                                                                                                                                                                                                                                                                      | BASE TABLE |
| [tPri\_RoomUserAssigned](https://docs.snapfix.com/engineering-reference/db/tables/tpri_roomuserassigned.md)                       | 13      | A user assigned to a room, with an unassigned flag. php-apis's sync reads it and its save action writes it; empty on staging.                                                                                                                                                                                                                                                                                    | BASE TABLE |

## Relations

```mermaid
erDiagram

"tPri_Area" }o--o| "tPri_Building" : "FOREIGN KEY (uuid_tBuilding) REFERENCES tPri_Building (uuid)"
"tPri_AreaUserAssigned" }o--o| "tPri_Area" : "FOREIGN KEY (uuid_tArea) REFERENCES tPri_Area (uuid)"
"tPri_BuildingRoomSection" }o--o| "tPri_Building" : "FOREIGN KEY (uuid_tBuilding) REFERENCES tPri_Building (uuid)"
"tPri_BuildingRoomStatus" }o--o| "tPri_Building" : "FOREIGN KEY (uuid_tBuilding) REFERENCES tPri_Building (uuid)"
"tPri_BuildingRoomStatusMain" }o--o| "tPri_BuildingRoomSection" : "FOREIGN KEY (uuid_tBuildingRoomSection) REFERENCES tPri_BuildingRoomSection (uuid)"
"tPri_BuildingRoomStatusMain" }o--o| "tPri_RoomStatusIcon" : "FOREIGN KEY (uuid_tRoomStatusIcon) REFERENCES tPri_RoomStatusIcon (uuid)"
"tPri_BuildingRoomStatusSecondary" }o--o| "tPri_BuildingRoomSection" : "FOREIGN KEY (uuid_tBuildingRoomSection) REFERENCES tPri_BuildingRoomSection (uuid)"
"tPri_BuildingRoomStatusSecondary" }o--o| "tPri_RoomStatusIcon" : "FOREIGN KEY (uuid_tRoomStatusIcon) REFERENCES tPri_RoomStatusIcon (uuid)"
"tPri_Room" }o--o| "tPri_Building" : "FOREIGN KEY (uuid_tBuilding) REFERENCES tPri_Building (uuid)"
"tPri_RoomUserAssigned" }o--o| "tPri_Room" : "FOREIGN KEY (uuid_tRoom) REFERENCES tPri_Room (uuid)"

"tPri_Area" {
  varchar_255_ uuid
  varchar_255_ uuid_tBuilding
}
"tPri_AreaUser" {
}
"tPri_AreaUserAssigned" {
  varchar_255_ uuid_tArea
}
"tPri_Building" {
  varchar_255_ uuid
}
"tPri_BuildingRoomSection" {
  varchar_255_ uuid
  varchar_255_ uuid_tBuilding
}
"tPri_BuildingRoomStatus" {
  varchar_255_ uuid_tBuilding
}
"tPri_BuildingRoomStatusMain" {
  varchar_255_ uuid_tBuildingRoomSection
  varchar_255_ uuid_tRoomStatusIcon
}
"tPri_BuildingRoomStatusSecondary" {
  varchar_255_ uuid_tBuildingRoomSection
  varchar_255_ uuid_tRoomStatusIcon
}
"tPri_JobArea" {
}
"tPri_JobRoom" {
}
"tPri_Log_AreaViewedUser" {
}
"tPri_Log_RoomStatusChange" {
}
"tPri_Log_RoomViewedUser" {
}
"tPri_ParentRoomStatus" {
}
"tPri_Room" {
  varchar_255_ uuid
  varchar_255_ uuid_tBuilding
}
"tPri_RoomBed" {
}
"tPri_RoomFeatures" {
}
"tPri_RoomGuestStatus" {
}
"tPri_RoomGuests" {
}
"tPri_RoomStatusIcon" {
  varchar_255_ uuid
}
"tPri_RoomUser" {
}
"tPri_RoomUserAssigned" {
  varchar_255_ uuid_tRoom
}
```

***

> 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-7.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.
