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

# tPri\_RoomGuests

{% 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/tPri_RoomGuests.md).
{% endhint %}

## Description

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

<details>

<summary><strong>Table Definition</strong></summary>

```sql
CREATE TABLE `tPri_RoomGuests` (
  `id` int NOT NULL AUTO_INCREMENT,
  `uuid` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `uuid_tRoomGuestStatus` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `guest_id` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `is_primary` tinyint DEFAULT '0',
  `first_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `last_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `phone` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `address_line1` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `address_line2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `address_line3` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `city` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `state` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `postal_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `country` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `country_code` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `dob` date DEFAULT NULL,
  `is_vip` tinyint DEFAULT '0',
  `nationality` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `language` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `fDeleted` tinyint DEFAULT NULL,
  `fCreatedTs` bigint DEFAULT NULL,
  `fModifiedTs` bigint DEFAULT NULL,
  `fServerTs` bigint DEFAULT NULL,
  `uuid_tUser_CreatedBy` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `uuid_tUser_ModifiedBy` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `uuid` (`uuid`) USING BTREE,
  KEY `idx_rg_status_deleted` (`uuid_tRoomGuestStatus`,`fDeleted`),
  KEY `idx_rg_status_deleted_guest` (`uuid_tRoomGuestStatus`,`fDeleted`,`guest_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC
```

</details>

## Columns

| Name                    | Type         | Default | Nullable | Extra Definition | Comment                                                                   |
| ----------------------- | ------------ | ------- | -------- | ---------------- | ------------------------------------------------------------------------- |
| id                      | int          |         | false    | auto\_increment  |                                                                           |
| uuid                    | varchar(255) |         | true     |                  |                                                                           |
| uuid\_tRoomGuestStatus  | varchar(255) |         | true     |                  | The booking the guest belongs to (tPri\_RoomGuestStatus); no foreign key. |
| guest\_id               | varchar(255) |         | true     |                  | The guest ID from the PMS; not unique on its own.                         |
| is\_primary             | tinyint      | 0       | true     |                  | 1 = the main guest of the booking.                                        |
| first\_name             | varchar(255) |         | true     |                  |                                                                           |
| last\_name              | varchar(255) |         | true     |                  |                                                                           |
| email                   | varchar(255) |         | true     |                  |                                                                           |
| phone                   | varchar(255) |         | true     |                  |                                                                           |
| address\_line1          | varchar(255) |         | true     |                  |                                                                           |
| address\_line2          | varchar(255) |         | true     |                  |                                                                           |
| address\_line3          | varchar(255) |         | true     |                  |                                                                           |
| city                    | varchar(255) |         | true     |                  |                                                                           |
| state                   | varchar(255) |         | true     |                  |                                                                           |
| postal\_code            | varchar(255) |         | true     |                  |                                                                           |
| country                 | varchar(255) |         | true     |                  |                                                                           |
| country\_code           | varchar(255) |         | true     |                  |                                                                           |
| dob                     | date         |         | true     |                  |                                                                           |
| is\_vip                 | tinyint      | 0       | true     |                  | 1 = VIP guest.                                                            |
| nationality             | varchar(255) |         | true     |                  |                                                                           |
| language                | varchar(255) |         | true     |                  |                                                                           |
| fDeleted                | tinyint      |         | true     |                  |                                                                           |
| fCreatedTs              | bigint       |         | true     |                  |                                                                           |
| fModifiedTs             | bigint       |         | true     |                  |                                                                           |
| fServerTs               | bigint       |         | true     |                  |                                                                           |
| uuid\_tUser\_CreatedBy  | varchar(255) |         | true     |                  |                                                                           |
| uuid\_tUser\_ModifiedBy | varchar(255) |         | true     |                  |                                                                           |

## Viewpoints

| Name                                                                             | Definition                                                                                                                 |
| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| [rooms](https://docs.snapfix.com/engineering-reference/db/tables/viewpoint-7.md) | Buildings, sections, areas and rooms, room statuses, guests and beds, the users linked to rooms and areas, and their logs. |

## Constraints

| Name    | Type        | Definition             |
| ------- | ----------- | ---------------------- |
| PRIMARY | PRIMARY KEY | PRIMARY KEY (id)       |
| uuid    | UNIQUE      | UNIQUE KEY uuid (uuid) |

## Indexes

| Name                            | Definition                                                                                    |
| ------------------------------- | --------------------------------------------------------------------------------------------- |
| idx\_rg\_status\_deleted        | KEY idx\_rg\_status\_deleted (uuid\_tRoomGuestStatus, fDeleted) USING BTREE                   |
| idx\_rg\_status\_deleted\_guest | KEY idx\_rg\_status\_deleted\_guest (uuid\_tRoomGuestStatus, fDeleted, guest\_id) USING BTREE |
| PRIMARY                         | PRIMARY KEY (id) USING BTREE                                                                  |
| uuid                            | UNIQUE KEY uuid (uuid) USING BTREE                                                            |

## Relations

```mermaid
erDiagram


"tPri_RoomGuests" {
  int id PK
}
```

***

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