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

# tPri\_UserPaywall

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

## Description

A user's in-app purchase offer for a site. Staging has one row, and no repo writes the table \[[ASK-144](https://github.com/snapfix/docs/blob/main/ASK.md#ask-144-who-may-buy-an-in-app-plan-for-a-site-and-who-sets-the-in-app-purchase-switch)].

<details>

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

```sql
CREATE TABLE `tPri_UserPaywall` (
  `id` int NOT NULL AUTO_INCREMENT,
  `uuid` varchar(255) DEFAULT NULL,
  `uuid_tParent` varchar(255) DEFAULT NULL,
  `uuid_tUser` varchar(255) DEFAULT NULL,
  `inapp_purchase` tinyint DEFAULT '1',
  `fNotes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `fDeleted` tinyint DEFAULT NULL,
  `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_userpaywall_user` (`uuid_tUser`),
  KEY `fk_userpaywall_parent` (`uuid_tParent`),
  KEY `fk_tPri_UserPaywall_createdbyuser` (`uuid_tUser_CreatedBy`),
  CONSTRAINT `fk_tPri_UserPaywall_createdbyuser` FOREIGN KEY (`uuid_tUser_CreatedBy`) REFERENCES `tPri_User` (`uuid`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_userPaywall_parent` FOREIGN KEY (`uuid_tParent`) REFERENCES `tPri_Parent` (`uuid`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_userPaywall_user` FOREIGN KEY (`uuid_tUser`) REFERENCES `tPri_User` (`uuid`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Everything within the app is permissible by default. If there is an entry in this table then we relay that data back to the apps and they can decide what to block and what to show.\nThe intention now is to make everything permissible unless there is an entry in this table for that user within that parent. If there is an entry then we use that entry’s setting when deciding if we allow it or not.\nFor example:\n— if there is no parent/user entry for inapp-purchase, then we assume that inapp-purchase is available for that user acting within the context of that parent.\n— if there is an entry for a specific parent/user then we apply those permissions to that user when they are acting with that parent. Let’s say inapp-purchase = 0, then we do not show them the option for inapp-purchase within the app.\n'
```

</details>

## Columns

| Name                    | Type         | Default | Nullable | Extra Definition | Parents                                                                                 | Comment                                                                                                                                                                                                                                                                                                                             |
| ----------------------- | ------------ | ------- | -------- | ---------------- | --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id                      | int          |         | false    | auto\_increment  |                                                                                         |                                                                                                                                                                                                                                                                                                                                     |
| uuid                    | varchar(255) |         | true     |                  |                                                                                         |                                                                                                                                                                                                                                                                                                                                     |
| uuid\_tParent           | varchar(255) |         | true     |                  | [tPri\_Parent](https://docs.snapfix.com/engineering-reference/db/tables/tpri_parent.md) |                                                                                                                                                                                                                                                                                                                                     |
| uuid\_tUser             | varchar(255) |         | true     |                  | [tPri\_User](https://docs.snapfix.com/engineering-reference/db/tables/tpri_user.md)     |                                                                                                                                                                                                                                                                                                                                     |
| inapp\_purchase         | tinyint      | 1       | true     |                  |                                                                                         | 1 offers this user the in-app plan purchase for this site in the apps. The column defaults to 1, ?action=paywall treats a site with no row as 1, and no repo writes the table \[[ASK-144](https://github.com/snapfix/docs/blob/main/ASK.md#ask-144-who-may-buy-an-in-app-plan-for-a-site-and-who-sets-the-in-app-purchase-switch)]. |
| fNotes                  | text         |         | true     |                  |                                                                                         |                                                                                                                                                                                                                                                                                                                                     |
| fDeleted                | tinyint      |         | 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                                                                                                                                                                           |
| ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [billing](https://docs.snapfix.com/engineering-reference/db/tables/viewpoint-13.md) | Plans and packages, the billing organisation (`tPri_Org`) with its Stripe, GoCardless, Xero and HubSpot deal records, in-app purchases, the paywall, support minutes and currencies. |

## Constraints

| Name                                 | Type        | Definition                                                        |
| ------------------------------------ | ----------- | ----------------------------------------------------------------- |
| fk\_tPri\_UserPaywall\_createdbyuser | FOREIGN KEY | FOREIGN KEY (uuid\_tUser\_CreatedBy) REFERENCES tPri\_User (uuid) |
| fk\_userPaywall\_parent              | FOREIGN KEY | FOREIGN KEY (uuid\_tParent) REFERENCES tPri\_Parent (uuid)        |
| fk\_userPaywall\_user                | FOREIGN KEY | FOREIGN KEY (uuid\_tUser) REFERENCES tPri\_User (uuid)            |
| PRIMARY                              | PRIMARY KEY | PRIMARY KEY (id)                                                  |
| uuid                                 | UNIQUE      | UNIQUE KEY uuid (uuid)                                            |

## Indexes

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

## Relations

```mermaid
erDiagram

"tPri_UserPaywall" }o--o| "tPri_Parent" : "FOREIGN KEY (uuid_tParent) REFERENCES tPri_Parent (uuid)"
"tPri_UserPaywall" }o--o| "tPri_User" : "FOREIGN KEY (uuid_tUser) REFERENCES tPri_User (uuid)"
"tPri_UserPaywall" }o--o| "tPri_User" : "FOREIGN KEY (uuid_tUser_CreatedBy) REFERENCES tPri_User (uuid)"

"tPri_UserPaywall" {
  int id PK
  varchar_255_ uuid_tParent FK
  varchar_255_ uuid_tUser 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_userpaywall.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.
