# public.role

## Columns

| Name | Type | Default | Nullable | Children | Parents | Comment |
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| createdAt | timestamp(3) with time zone | CURRENT_TIMESTAMP(3) | false |  |  |  |
| description | text |  | true |  |  | Text describing the scope in more detail of users |
| displayName | text |  | true |  |  | Name used to display in the UI |
| roleType | text |  | true |  |  | Type of the role, e.g., global, project, or workflow |
| slug | varchar(128) |  | false | [public.project_relation](public.project_relation.md) [public.role_mapping_rule](public.role_mapping_rule.md) [public.role_scope](public.role_scope.md) [public.user](public.user.md) |  | Unique identifier of the role for example: "global:owner" |
| systemRole | boolean | false | false |  |  | Indicates if the role is managed by the system and cannot be edited |
| updatedAt | timestamp(3) with time zone | CURRENT_TIMESTAMP(3) | false |  |  |  |

## Constraints

| Name | Type | Definition |
| ---- | ---- | ---------- |
| PK_35c9b140caaf6da09cfabb0d675 | PRIMARY KEY | PRIMARY KEY (slug) |
| role_createdAt_not_null | n | NOT NULL "createdAt" |
| role_slug_not_null | n | NOT NULL slug |
| role_systemRole_not_null | n | NOT NULL "systemRole" |
| role_updatedAt_not_null | n | NOT NULL "updatedAt" |

## Indexes

| Name | Definition |
| ---- | ---------- |
| IDX_UniqueRoleDisplayName | CREATE UNIQUE INDEX "IDX_UniqueRoleDisplayName" ON public.role USING btree ("displayName") |
| PK_35c9b140caaf6da09cfabb0d675 | CREATE UNIQUE INDEX "PK_35c9b140caaf6da09cfabb0d675" ON public.role USING btree (slug) |

## Relations

```mermaid
erDiagram

"public.project_relation" }o--|| "public.role" : "FOREIGN KEY (role) REFERENCES role(slug)"
"public.role_mapping_rule" }o--|| "public.role" : "FOREIGN KEY (role) REFERENCES role(slug) ON UPDATE CASCADE ON DELETE CASCADE"
"public.role_scope" }o--|| "public.role" : "FOREIGN KEY (#quot;roleSlug#quot;) REFERENCES role(slug) ON UPDATE CASCADE ON DELETE CASCADE"
"public.user" }o--|| "public.role" : "FOREIGN KEY (#quot;roleSlug#quot;) REFERENCES role(slug)"

"public.role" {
  timestamp_3__with_time_zone createdAt
  text description
  text displayName
  text roleType
  varchar_128_ slug
  boolean systemRole
  timestamp_3__with_time_zone updatedAt
}
"public.project_relation" {
  timestamp_3__with_time_zone createdAt
  varchar_36_ projectId FK
  varchar role FK
  timestamp_3__with_time_zone updatedAt
  uuid userId FK
}
"public.role_mapping_rule" {
  timestamp_3__with_time_zone createdAt
  text expression
  varchar_16_ id
  integer order
  varchar_128_ role FK
  varchar_64_ type
  timestamp_3__with_time_zone updatedAt
}
"public.role_scope" {
  varchar_128_ roleSlug FK
  varchar_128_ scopeSlug FK
}
"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)
