# public.oauth_user_consents

## Columns

| Name | Type | Default | Nullable | Children | Parents | Comment |
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| clientId | varchar |  | false |  | [public.oauth_clients](public.oauth_clients.md) |  |
| grantedAt | bigint |  | false |  |  | Unix timestamp in milliseconds |
| id | integer |  | false |  |  |  |
| scope | json |  | false |  |  | OAuth scopes granted on the consent screen |
| userId | uuid |  | false |  | [public.user](public.user.md) |  |

## Constraints

| Name | Type | Definition |
| ---- | ---- | ---------- |
| FK_21e6c3c2d78a097478fae6aaefa | FOREIGN KEY | FOREIGN KEY ("userId") REFERENCES "user"(id) ON DELETE CASCADE |
| FK_a651acea2f6c97f8c4514935486 | FOREIGN KEY | FOREIGN KEY ("clientId") REFERENCES oauth_clients(id) ON DELETE CASCADE |
| PK_85b9ada746802c8993103470f05 | PRIMARY KEY | PRIMARY KEY (id) |
| UQ_083721d99ce8db4033e2958ebb4 | UNIQUE | UNIQUE ("userId", "clientId") |
| oauth_user_consents_clientId_not_null | n | NOT NULL "clientId" |
| oauth_user_consents_grantedAt_not_null | n | NOT NULL "grantedAt" |
| oauth_user_consents_id_not_null | n | NOT NULL id |
| oauth_user_consents_scope_not_null | n | NOT NULL scope |
| oauth_user_consents_userId_not_null | n | NOT NULL "userId" |

## Indexes

| Name | Definition |
| ---- | ---------- |
| PK_85b9ada746802c8993103470f05 | CREATE UNIQUE INDEX "PK_85b9ada746802c8993103470f05" ON public.oauth_user_consents USING btree (id) |
| UQ_083721d99ce8db4033e2958ebb4 | CREATE UNIQUE INDEX "UQ_083721d99ce8db4033e2958ebb4" ON public.oauth_user_consents USING btree ("userId", "clientId") |

## Relations

```mermaid
erDiagram

"public.oauth_user_consents" }o--|| "public.oauth_clients" : "FOREIGN KEY (#quot;clientId#quot;) REFERENCES oauth_clients(id) ON DELETE CASCADE"
"public.oauth_user_consents" }o--|| "public.user" : "FOREIGN KEY (#quot;userId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE CASCADE"

"public.oauth_user_consents" {
  varchar clientId FK
  bigint grantedAt
  integer id
  json scope
  uuid userId FK
}
"public.oauth_clients" {
  varchar_255_ clientSecret
  bigint clientSecretExpiresAt
  timestamp_3__with_time_zone createdAt
  json grantTypes
  varchar id
  boolean isFirstParty
  varchar_255_ name
  json redirectUris
  varchar_255_ tokenEndpointAuthMethod
  timestamp_3__with_time_zone updatedAt
}
"public.user" {
  timestamp_3__with_time_zone createdAt
  boolean disabled
  varchar_255_ email
  varchar_32_ firstName
  uuid id
  date lastActiveAt
  varchar_32_ lastName
  boolean mfaEnabled
  text mfaRecoveryCodes
  text mfaSecret
  varchar_255_ password
  json personalizationAnswers
  varchar_128_ roleSlug FK
  json settings
  timestamp_3__with_time_zone updatedAt
}
```

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
