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

# comply\_Contractor

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

## Description

One contractor of a site (uuid\_tParent), with contact details and an expiry date. Deleting sets fDeleted.

<details>

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

```sql
CREATE TABLE `comply_Contractor` (
  `id` int NOT NULL AUTO_INCREMENT,
  `uuid` varchar(255) DEFAULT NULL,
  `uuid_tParent` varchar(255) DEFAULT NULL,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `phone_country_iso` varchar(255) DEFAULT NULL,
  `phone_countrycode` varchar(255) DEFAULT NULL,
  `phone_number` varchar(255) DEFAULT NULL,
  `service_type` varchar(255) DEFAULT NULL,
  `contact_name` varchar(255) DEFAULT NULL,
  `sort_order` int DEFAULT '1000',
  `expiryTs` bigint DEFAULT NULL,
  `expiryAlertDays` int DEFAULT NULL,
  `frequencyDescription` varchar(255) DEFAULT NULL,
  `uuid_enumFrequency` varchar(255) DEFAULT NULL,
  `note` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `color` varchar(255) DEFAULT NULL,
  `fRedTs` bigint DEFAULT NULL,
  `fAmberTs` bigint DEFAULT NULL,
  `fGreenTs` bigint DEFAULT NULL,
  `uuid_tUser_Red` varchar(255) DEFAULT NULL,
  `uuid_tUser_Amber` varchar(255) DEFAULT NULL,
  `uuid_tUser_Green` varchar(255) DEFAULT NULL,
  `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,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `uuid` (`uuid`) USING BTREE,
  KEY `fk_comply_contractor_parent` (`uuid_tParent`),
  KEY `fk_comply_contractor_frequency` (`uuid_enumFrequency`),
  KEY `fk_comply_contractor_createdbyuser` (`uuid_tUser_CreatedBy`),
  CONSTRAINT `fk_comply_contractor_createdbyuser` FOREIGN KEY (`uuid_tUser_CreatedBy`) REFERENCES `tPri_User` (`uuid`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_comply_contractor_frequency` FOREIGN KEY (`uuid_enumFrequency`) REFERENCES `comply_enumFrequency` (`uuid`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_comply_contractor_parent` FOREIGN KEY (`uuid_tParent`) REFERENCES `tPri_Parent` (`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     |                  | [comply\_ContractorAsset](https://docs.snapfix.com/engineering-reference/db/tables/comply_contractorasset.md) [comply\_ContractorDocument](https://docs.snapfix.com/engineering-reference/db/tables/comply_contractordocument.md) [comply\_ContractorLog](https://docs.snapfix.com/engineering-reference/db/tables/comply_contractorlog.md) [comply\_ContractorTag](https://docs.snapfix.com/engineering-reference/db/tables/comply_contractortag.md) [comply\_ContractorUserAssigned](https://docs.snapfix.com/engineering-reference/db/tables/comply_contractoruserassigned.md) [comply\_SystemContractor](https://docs.snapfix.com/engineering-reference/db/tables/comply_systemcontractor.md) |                                                                                                           |                                                                                                                                                                                                             |
| uuid\_tParent           | varchar(255)  |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | [tPri\_Parent](https://docs.snapfix.com/engineering-reference/db/tables/tpri_parent.md)                   |                                                                                                                                                                                                             |
| name                    | varchar(255)  |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                           |                                                                                                                                                                                                             |
| email                   | varchar(255)  |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                           |                                                                                                                                                                                                             |
| phone\_country\_iso     | varchar(255)  |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                           |                                                                                                                                                                                                             |
| phone\_countrycode      | varchar(255)  |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                           |                                                                                                                                                                                                             |
| phone\_number           | varchar(255)  |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                           |                                                                                                                                                                                                             |
| service\_type           | varchar(255)  |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                           |                                                                                                                                                                                                             |
| contact\_name           | varchar(255)  |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                           |                                                                                                                                                                                                             |
| sort\_order             | int           | 1000    | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                           |                                                                                                                                                                                                             |
| expiryTs                | bigint        |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                           |                                                                                                                                                                                                             |
| expiryAlertDays         | int           |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                           |                                                                                                                                                                                                             |
| frequencyDescription    | varchar(255)  |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                           |                                                                                                                                                                                                             |
| uuid\_enumFrequency     | varchar(255)  |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | [comply\_enumFrequency](https://docs.snapfix.com/engineering-reference/db/tables/comply_enumfrequency.md) | Never written; the frequency is kept only as frequencyDescription text.                                                                                                                                     |
| note                    | varchar(1000) |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                           |                                                                                                                                                                                                             |
| color                   | varchar(255)  |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                           | No code writes it (the API's color update does nothing). The list and detail endpoints compute the color on read instead, red after expiryTs, amber within expiryAlertDays days before it, otherwise green. |
| fRedTs                  | bigint        |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                           | Never written or used by any code.                                                                                                                                                                          |
| fAmberTs                | bigint        |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                           | Never written or used by any code.                                                                                                                                                                          |
| fGreenTs                | bigint        |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                           | Never written or used by any code.                                                                                                                                                                          |
| uuid\_tUser\_Red        | varchar(255)  |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                           | Never written or used by any code.                                                                                                                                                                          |
| uuid\_tUser\_Amber      | varchar(255)  |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                           | Never written or used by any code.                                                                                                                                                                          |
| uuid\_tUser\_Green      | varchar(255)  |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                           | Never written or used by any code.                                                                                                                                                                          |
| 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     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                                                           |                                                                                                                                                                                                             |

## Viewpoints

| Name                                                                                   | Definition                                                                                                                   |
| -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| [compliance](https://docs.snapfix.com/engineering-reference/db/tables/viewpoint-10.md) | Snapfix Comply: system types, systems, contractors, documents, their links to assets, tasks, tags and users, and their logs. |

## Constraints

| Name                                  | Type        | Definition                                                                |
| ------------------------------------- | ----------- | ------------------------------------------------------------------------- |
| fk\_comply\_contractor\_createdbyuser | FOREIGN KEY | FOREIGN KEY (uuid\_tUser\_CreatedBy) REFERENCES tPri\_User (uuid)         |
| fk\_comply\_contractor\_frequency     | FOREIGN KEY | FOREIGN KEY (uuid\_enumFrequency) REFERENCES comply\_enumFrequency (uuid) |
| fk\_comply\_contractor\_parent        | FOREIGN KEY | FOREIGN KEY (uuid\_tParent) REFERENCES tPri\_Parent (uuid)                |
| PRIMARY                               | PRIMARY KEY | PRIMARY KEY (id)                                                          |
| uuid                                  | UNIQUE      | UNIQUE KEY uuid (uuid)                                                    |

## Indexes

| Name                                  | Definition                                                                     |
| ------------------------------------- | ------------------------------------------------------------------------------ |
| fk\_comply\_contractor\_createdbyuser | KEY fk\_comply\_contractor\_createdbyuser (uuid\_tUser\_CreatedBy) USING BTREE |
| fk\_comply\_contractor\_frequency     | KEY fk\_comply\_contractor\_frequency (uuid\_enumFrequency) USING BTREE        |
| fk\_comply\_contractor\_parent        | KEY fk\_comply\_contractor\_parent (uuid\_tParent) USING BTREE                 |
| PRIMARY                               | PRIMARY KEY (id) USING BTREE                                                   |
| uuid                                  | UNIQUE KEY uuid (uuid) USING BTREE                                             |

## Relations

```mermaid
erDiagram

"comply_ContractorAsset" }o--o| "comply_Contractor" : "FOREIGN KEY (uuid_Contractor) REFERENCES comply_Contractor (uuid)"
"comply_ContractorDocument" }o--o| "comply_Contractor" : "FOREIGN KEY (uuid_Contractor) REFERENCES comply_Contractor (uuid)"
"comply_ContractorLog" }o--o| "comply_Contractor" : "FOREIGN KEY (uuid_Contractor) REFERENCES comply_Contractor (uuid)"
"comply_ContractorTag" }o--o| "comply_Contractor" : "FOREIGN KEY (uuid_Contractor) REFERENCES comply_Contractor (uuid)"
"comply_ContractorUserAssigned" }o--o| "comply_Contractor" : "FOREIGN KEY (uuid_Contractor) REFERENCES comply_Contractor (uuid)"
"comply_SystemContractor" }o--o| "comply_Contractor" : "FOREIGN KEY (uuid_Contractor) REFERENCES comply_Contractor (uuid)"
"comply_Contractor" }o--o| "tPri_Parent" : "FOREIGN KEY (uuid_tParent) REFERENCES tPri_Parent (uuid)"
"comply_Contractor" }o--o| "comply_enumFrequency" : "FOREIGN KEY (uuid_enumFrequency) REFERENCES comply_enumFrequency (uuid)"
"comply_Contractor" }o--o| "tPri_User" : "FOREIGN KEY (uuid_tUser_CreatedBy) REFERENCES tPri_User (uuid)"

"comply_Contractor" {
  int id PK
  varchar_255_ uuid
  varchar_255_ uuid_tParent FK
  varchar_255_ uuid_enumFrequency FK
  varchar_255_ uuid_tUser_CreatedBy FK
}
"comply_ContractorAsset" {
  int id PK
  varchar_255_ uuid_Contractor FK
  varchar_255_ uuid_tJob FK
  varchar_255_ uuid_tUser_CreatedBy FK
}
"comply_ContractorDocument" {
  int id PK
  varchar_255_ uuid_Contractor FK
  varchar_255_ uuid_Document FK
  varchar_255_ uuid_tUser_CreatedBy FK
}
"comply_ContractorLog" {
  int id PK
  varchar_255_ uuid_Contractor FK
  varchar_255_ uuid_Log FK
  varchar_255_ uuid_tUser_CreatedBy FK
}
"comply_ContractorTag" {
  int id PK
  varchar_255_ uuid_Contractor FK
  varchar_255_ uuid_tTag FK
  varchar_255_ uuid_tUser_CreatedBy FK
}
"comply_ContractorUserAssigned" {
  int id PK
  varchar_255_ uuid_Contractor FK
  varchar_255_ uuid_tUser FK
  varchar_255_ uuid_tUser_CreatedBy FK
}
"comply_SystemContractor" {
  int id PK
  varchar_255_ uuid_System FK
  varchar_255_ uuid_Contractor FK
  varchar_255_ uuid_tUser_CreatedBy FK
}
"tPri_Parent" {
  int id PK
  varchar_255_ uuid
  varchar_255_ uuid_tUser_CreatedBy FK
}
"comply_enumFrequency" {
  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/comply_contractor.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.
