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

# comply\_System

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

## Description

One compliance system of a site, under a system type (uuid\_SystemType), with an expiry date and alert days. Deleting sets fDeleted and leaves its task links in tPri\_JobComplySystem.

<details>

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

```sql
CREATE TABLE `comply_System` (
  `id` int NOT NULL AUTO_INCREMENT,
  `uuid` varchar(255) DEFAULT NULL,
  `uuid_SystemType` varchar(255) DEFAULT NULL,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci 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_system_systemtype` (`uuid_SystemType`),
  KEY `fk_comply_system_frequency` (`uuid_enumFrequency`),
  KEY `fk_comply_system_createdbyuser` (`uuid_tUser_CreatedBy`),
  CONSTRAINT `fk_comply_system_createdbyuser` FOREIGN KEY (`uuid_tUser_CreatedBy`) REFERENCES `tPri_User` (`uuid`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_comply_system_frequency` FOREIGN KEY (`uuid_enumFrequency`) REFERENCES `comply_enumFrequency` (`uuid`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_comply_system_systemtype` FOREIGN KEY (`uuid_SystemType`) REFERENCES `comply_SystemType` (`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\_SystemAsset](https://docs.snapfix.com/engineering-reference/db/tables/comply_systemasset.md) [comply\_SystemContractor](https://docs.snapfix.com/engineering-reference/db/tables/comply_systemcontractor.md) [comply\_SystemDocument](https://docs.snapfix.com/engineering-reference/db/tables/comply_systemdocument.md) [comply\_SystemLog](https://docs.snapfix.com/engineering-reference/db/tables/comply_systemlog.md) [comply\_SystemTag](https://docs.snapfix.com/engineering-reference/db/tables/comply_systemtag.md) [comply\_SystemUserAssigned](https://docs.snapfix.com/engineering-reference/db/tables/comply_systemuserassigned.md) [tPri\_JobComplySystem](https://docs.snapfix.com/engineering-reference/db/tables/tpri_jobcomplysystem.md) |                                                                                                           |                                                                                                                                                                                                                                                                             |
| uuid\_SystemType        | varchar(255)  |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | [comply\_SystemType](https://docs.snapfix.com/engineering-reference/db/tables/comply_systemtype.md)       |                                                                                                                                                                                                                                                                             |
| name                    | varchar(255)  |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                                           |                                                                                                                                                                                                                                                                             |
| sort\_order             | int           | 1000    | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                                           |                                                                                                                                                                                                                                                                             |
| expiryTs                | bigint        |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                                           |                                                                                                                                                                                                                                                                             |
| expiryAlertDays         | int           |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                                           | Days before expiryTs when the color turns amber. The default systems a site gets are created without it, so they never turn amber \[[ASK-140](https://github.com/snapfix/docs/blob/main/ASK.md#ask-140-should-the-default-compliance-systems-get-the-30-day-expiry-alert)]. |
| 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). Every read computes the color instead, red after expiryTs, amber within expiryAlertDays days before it, otherwise green (the system overview inverts red and green).                                               |
| fRedTs                  | bigint        |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                                           | Never written; the apps download it with the row and never use it.                                                                                                                                                                                                          |
| fAmberTs                | bigint        |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                                           | Never written; the apps download it with the row and never use it.                                                                                                                                                                                                          |
| fGreenTs                | bigint        |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                                           | Never written; the apps download it with the row and never use it.                                                                                                                                                                                                          |
| uuid\_tUser\_Red        | varchar(255)  |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                                           | Never written; the apps download it with the row and never use it.                                                                                                                                                                                                          |
| uuid\_tUser\_Amber      | varchar(255)  |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                                           | Never written; the apps download it with the row and never use it.                                                                                                                                                                                                          |
| uuid\_tUser\_Green      | varchar(255)  |         | true     |                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                                           | Never written; the apps download it with the row and never use it.                                                                                                                                                                                                          |
| 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\_system\_createdbyuser | FOREIGN KEY | FOREIGN KEY (uuid\_tUser\_CreatedBy) REFERENCES tPri\_User (uuid)         |
| fk\_comply\_system\_frequency     | FOREIGN KEY | FOREIGN KEY (uuid\_enumFrequency) REFERENCES comply\_enumFrequency (uuid) |
| fk\_comply\_system\_systemtype    | FOREIGN KEY | FOREIGN KEY (uuid\_SystemType) REFERENCES comply\_SystemType (uuid)       |
| PRIMARY                           | PRIMARY KEY | PRIMARY KEY (id)                                                          |
| uuid                              | UNIQUE      | UNIQUE KEY uuid (uuid)                                                    |

## Indexes

| Name                              | Definition                                                                 |
| --------------------------------- | -------------------------------------------------------------------------- |
| fk\_comply\_system\_createdbyuser | KEY fk\_comply\_system\_createdbyuser (uuid\_tUser\_CreatedBy) USING BTREE |
| fk\_comply\_system\_frequency     | KEY fk\_comply\_system\_frequency (uuid\_enumFrequency) USING BTREE        |
| fk\_comply\_system\_systemtype    | KEY fk\_comply\_system\_systemtype (uuid\_SystemType) USING BTREE          |
| PRIMARY                           | PRIMARY KEY (id) USING BTREE                                               |
| uuid                              | UNIQUE KEY uuid (uuid) USING BTREE                                         |

## Relations

```mermaid
erDiagram

"comply_SystemAsset" }o--o| "comply_System" : "FOREIGN KEY (uuid_System) REFERENCES comply_System (uuid)"
"comply_SystemContractor" }o--o| "comply_System" : "FOREIGN KEY (uuid_System) REFERENCES comply_System (uuid)"
"comply_SystemDocument" }o--o| "comply_System" : "FOREIGN KEY (uuid_System) REFERENCES comply_System (uuid)"
"comply_SystemLog" }o--o| "comply_System" : "FOREIGN KEY (uuid_System) REFERENCES comply_System (uuid)"
"comply_SystemTag" }o--o| "comply_System" : "FOREIGN KEY (uuid_System) REFERENCES comply_System (uuid)"
"comply_SystemUserAssigned" }o--o| "comply_System" : "FOREIGN KEY (uuid_System) REFERENCES comply_System (uuid)"
"tPri_JobComplySystem" }o--o| "comply_System" : "FOREIGN KEY (uuid_System) REFERENCES comply_System (uuid)"
"comply_System" }o--o| "comply_SystemType" : "FOREIGN KEY (uuid_SystemType) REFERENCES comply_SystemType (uuid)"
"comply_System" }o--o| "comply_enumFrequency" : "FOREIGN KEY (uuid_enumFrequency) REFERENCES comply_enumFrequency (uuid)"
"comply_System" }o--o| "tPri_User" : "FOREIGN KEY (uuid_tUser_CreatedBy) REFERENCES tPri_User (uuid)"

"comply_System" {
  int id PK
  varchar_255_ uuid
  varchar_255_ uuid_SystemType FK
  varchar_255_ uuid_enumFrequency FK
  varchar_255_ uuid_tUser_CreatedBy FK
}
"comply_SystemAsset" {
  int id PK
  varchar_255_ uuid_System FK
  varchar_255_ uuid_tJob 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
}
"comply_SystemDocument" {
  int id PK
  varchar_255_ uuid_System FK
  varchar_255_ uuid_Document FK
  varchar_255_ uuid_tUser_CreatedBy FK
}
"comply_SystemLog" {
  int id PK
  varchar_255_ uuid_System FK
  varchar_255_ uuid_Log FK
  varchar_255_ uuid_tUser_CreatedBy FK
}
"comply_SystemTag" {
  int id PK
  varchar_255_ uuid_System FK
  varchar_255_ uuid_tTag FK
  varchar_255_ uuid_tUser_CreatedBy FK
}
"comply_SystemUserAssigned" {
  int id PK
  varchar_255_ uuid_System FK
  varchar_255_ uuid_tUser FK
  varchar_255_ uuid_tUser_CreatedBy FK
}
"tPri_JobComplySystem" {
  int id PK
  varchar_255_ uuid_System FK
  varchar_255_ uuid_tJob FK
  varchar_255_ uuid_tUser_CreatedBy FK
}
"comply_SystemType" {
  int id PK
  varchar_255_ uuid
  varchar_255_ uuid_tParent FK
  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_system.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.
