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

# tPri\_Building

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

## Description

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.

<details>

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

```sql
CREATE TABLE `tPri_Building` (
  `id` int NOT NULL AUTO_INCREMENT,
  `uuid` varchar(255) DEFAULT NULL,
  `uuid_tParent` varchar(255) DEFAULT NULL,
  `enum_BuildingType` varchar(255) DEFAULT 'standard',
  `fName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `fAddress` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `fImage` varchar(255) DEFAULT NULL,
  `fLat` double DEFAULT NULL,
  `fLng` double DEFAULT NULL,
  `sort_order` int DEFAULT '1000',
  `fOrigin` varchar(255) DEFAULT NULL,
  `fInActive` tinyint DEFAULT '0',
  `fDeleted` tinyint DEFAULT '0',
  `fCreatedTs` bigint DEFAULT NULL,
  `fModifiedTs` bigint DEFAULT NULL,
  `fServerTs` bigint DEFAULT NULL,
  `uuid_tUser_CreatedBy` varchar(255) DEFAULT NULL,
  `uuid_tUser_ModifiedBy` varchar(255) DEFAULT NULL,
  `excludeFromApi` tinyint DEFAULT '0',
  `excludeFromApiTs` bigint DEFAULT NULL,
  `ai_task_management_enabled` tinyint DEFAULT '0',
  `manual_room_status_enabled` tinyint DEFAULT '1',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `uuid` (`uuid`) USING BTREE,
  KEY `fk_building_parent` (`uuid_tParent`),
  KEY `fk_tPri_building_createdbyuser` (`uuid_tUser_CreatedBy`),
  CONSTRAINT `fk_building_parent` FOREIGN KEY (`uuid_tParent`) REFERENCES `tPri_Parent` (`uuid`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_tPri_building_createdbyuser` FOREIGN KEY (`uuid_tUser_CreatedBy`) REFERENCES `tPri_User` (`uuid`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=latin1
```

</details>

## Columns

| Name                          | Type         | Default  | Nullable | Extra Definition | Children                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | Parents                                                                                 | Comment                                                                                                                                                                                                                                                                                                                     |
| ----------------------------- | ------------ | -------- | -------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id                            | int          |          | false    | auto\_increment  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                         |                                                                                                                                                                                                                                                                                                                             |
| uuid                          | varchar(255) |          | true     |                  | [cloudbeds\_BuildingSiteMapping](https://docs.snapfix.com/engineering-reference/db/tables/cloudbeds_buildingsitemapping.md) [comtrol\_BuildingSiteMapping](https://docs.snapfix.com/engineering-reference/db/tables/comtrol_buildingsitemapping.md) [guestline\_BuildingSiteMapping](https://docs.snapfix.com/engineering-reference/db/tables/guestline_buildingsitemapping.md) [hotsoft\_BuildingSiteMapping](https://docs.snapfix.com/engineering-reference/db/tables/hotsoft_buildingsitemapping.md) [jonaschorum\_BuildingSiteMapping](https://docs.snapfix.com/engineering-reference/db/tables/jonaschorum_buildingsitemapping.md) [opera\_BuildingSiteMapping](https://docs.snapfix.com/engineering-reference/db/tables/opera_buildingsitemapping.md) [stayntouch\_BuildingSiteMapping](https://docs.snapfix.com/engineering-reference/db/tables/stayntouch_buildingsitemapping.md) [tPri\_Area](https://docs.snapfix.com/engineering-reference/db/tables/tpri_area.md) [tPri\_BuildingRoomSection](https://docs.snapfix.com/engineering-reference/db/tables/tpri_buildingroomsection.md) [tPri\_BuildingRoomStatus](https://docs.snapfix.com/engineering-reference/db/tables/tpri_buildingroomstatus.md) [tPri\_Room](https://docs.snapfix.com/engineering-reference/db/tables/tpri_room.md) |                                                                                         |                                                                                                                                                                                                                                                                                                                             |
| uuid\_tParent                 | varchar(255) |          | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | [tPri\_Parent](https://docs.snapfix.com/engineering-reference/db/tables/tpri_parent.md) | The site the building belongs to. Its key is not unique, so a site can have more than one building; the vendor API's room and area lists read only the first one found \[[ASK-162](https://github.com/snapfix/docs/blob/main/ASK.md#ask-162-should-the-vendor-api-return-the-rooms-and-areas-of-every-building-of-a-site)]. |
| enum\_BuildingType            | varchar(255) | standard | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                         | Only standard occurs on staging.                                                                                                                                                                                                                                                                                            |
| fName                         | varchar(255) |          | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                         |                                                                                                                                                                                                                                                                                                                             |
| fAddress                      | varchar(255) |          | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                         |                                                                                                                                                                                                                                                                                                                             |
| fImage                        | varchar(255) |          | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                         |                                                                                                                                                                                                                                                                                                                             |
| fLat                          | double       |          | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                         |                                                                                                                                                                                                                                                                                                                             |
| fLng                          | double       |          | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                         |                                                                                                                                                                                                                                                                                                                             |
| sort\_order                   | int          | 1000     | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                         |                                                                                                                                                                                                                                                                                                                             |
| fOrigin                       | varchar(255) |          | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                         |                                                                                                                                                                                                                                                                                                                             |
| fInActive                     | tinyint      | 0        | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                         |                                                                                                                                                                                                                                                                                                                             |
| fDeleted                      | tinyint      | 0        | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                         |                                                                                                                                                                                                                                                                                                                             |
| fCreatedTs                    | bigint       |          | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                         |                                                                                                                                                                                                                                                                                                                             |
| fModifiedTs                   | bigint       |          | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                         |                                                                                                                                                                                                                                                                                                                             |
| fServerTs                     | bigint       |          | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                         |                                                                                                                                                                                                                                                                                                                             |
| uuid\_tUser\_CreatedBy        | varchar(255) |          | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | [tPri\_User](https://docs.snapfix.com/engineering-reference/db/tables/tpri_user.md)     |                                                                                                                                                                                                                                                                                                                             |
| uuid\_tUser\_ModifiedBy       | varchar(255) |          | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                         |                                                                                                                                                                                                                                                                                                                             |
| excludeFromApi                | tinyint      | 0        | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                         |                                                                                                                                                                                                                                                                                                                             |
| excludeFromApiTs              | bigint       |          | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                         |                                                                                                                                                                                                                                                                                                                             |
| ai\_task\_management\_enabled | tinyint      | 0        | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                         |                                                                                                                                                                                                                                                                                                                             |
| manual\_room\_status\_enabled | tinyint      | 1        | 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                                                        |
| --------------------------------- | ----------- | ----------------------------------------------------------------- |
| fk\_building\_parent              | FOREIGN KEY | FOREIGN KEY (uuid\_tParent) REFERENCES tPri\_Parent (uuid)        |
| fk\_tPri\_building\_createdbyuser | FOREIGN KEY | FOREIGN KEY (uuid\_tUser\_CreatedBy) REFERENCES tPri\_User (uuid) |
| PRIMARY                           | PRIMARY KEY | PRIMARY KEY (id)                                                  |
| uuid                              | UNIQUE      | UNIQUE KEY uuid (uuid)                                            |

## Indexes

| Name                              | Definition                                                                 |
| --------------------------------- | -------------------------------------------------------------------------- |
| fk\_building\_parent              | KEY fk\_building\_parent (uuid\_tParent) USING BTREE                       |
| fk\_tPri\_building\_createdbyuser | KEY fk\_tPri\_building\_createdbyuser (uuid\_tUser\_CreatedBy) USING BTREE |
| PRIMARY                           | PRIMARY KEY (id) USING BTREE                                               |
| uuid                              | UNIQUE KEY uuid (uuid) USING BTREE                                         |

## Relations

```mermaid
erDiagram

"cloudbeds_BuildingSiteMapping" }o--o| "tPri_Building" : "FOREIGN KEY (uuid_tBuilding) REFERENCES tPri_Building (uuid)"
"comtrol_BuildingSiteMapping" }o--o| "tPri_Building" : "FOREIGN KEY (uuid_tBuilding) REFERENCES tPri_Building (uuid)"
"guestline_BuildingSiteMapping" }o--o| "tPri_Building" : "FOREIGN KEY (uuid_tBuilding) REFERENCES tPri_Building (uuid)"
"hotsoft_BuildingSiteMapping" }o--o| "tPri_Building" : "FOREIGN KEY (uuid_tBuilding) REFERENCES tPri_Building (uuid)"
"jonaschorum_BuildingSiteMapping" }o--o| "tPri_Building" : "FOREIGN KEY (uuid_tBuilding) REFERENCES tPri_Building (uuid)"
"opera_BuildingSiteMapping" }o--o| "tPri_Building" : "FOREIGN KEY (uuid_tBuilding) REFERENCES tPri_Building (uuid)"
"stayntouch_BuildingSiteMapping" }o--o| "tPri_Building" : "FOREIGN KEY (uuid_tBuilding) REFERENCES tPri_Building (uuid)"
"tPri_Area" }o--o| "tPri_Building" : "FOREIGN KEY (uuid_tBuilding) REFERENCES tPri_Building (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_Room" }o--o| "tPri_Building" : "FOREIGN KEY (uuid_tBuilding) REFERENCES tPri_Building (uuid)"
"tPri_Building" }o--o| "tPri_Parent" : "FOREIGN KEY (uuid_tParent) REFERENCES tPri_Parent (uuid)"
"tPri_Building" }o--o| "tPri_User" : "FOREIGN KEY (uuid_tUser_CreatedBy) REFERENCES tPri_User (uuid)"

"tPri_Building" {
  int id PK
  varchar_255_ uuid
  varchar_255_ uuid_tParent FK
  varchar_255_ uuid_tUser_CreatedBy FK
}
"cloudbeds_BuildingSiteMapping" {
  int id PK
  varchar_255_ uuid_tBuilding FK
}
"comtrol_BuildingSiteMapping" {
  int id PK
  varchar_255_ uuid_tBuilding FK
}
"guestline_BuildingSiteMapping" {
  int id PK
  varchar_255_ uuid_tBuilding FK
}
"hotsoft_BuildingSiteMapping" {
  int id PK
  varchar_255_ uuid_tBuilding FK
}
"jonaschorum_BuildingSiteMapping" {
  int id PK
  varchar_255_ uuid_tBuilding FK
}
"opera_BuildingSiteMapping" {
  int id PK
  varchar_255_ uuid_tBuilding FK
}
"stayntouch_BuildingSiteMapping" {
  int id PK
  varchar_255_ uuid_tBuilding FK
}
"tPri_Area" {
  int id PK
  varchar_255_ uuid
  varchar_255_ uuid_tBuilding FK
  varchar_255_ uuid_tUser_CreatedBy FK
}
"tPri_BuildingRoomSection" {
  int id PK
  varchar_255_ uuid
  varchar_255_ uuid_tBuilding FK
}
"tPri_BuildingRoomStatus" {
  int id PK
  varchar_255_ uuid_tBuilding FK
  varchar_255_ uuid_tUser_CreatedBy FK
}
"tPri_Room" {
  int id PK
  varchar_255_ uuid
  varchar_255_ uuid_tBuilding FK
  varchar_255_ uuid_tUser_CreatedBy FK
}
"tPri_Parent" {
  int id PK
  varchar_255_ uuid
  varchar_255_ uuid_tUser_CreatedBy FK
}
"tPri_User" {
  int id PK
  varchar_255_ uuid
  varchar_255_ uuid_tUser_CreatedBy FK
}
```

***

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