# role_mapping_rule

## Description

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

```sql
CREATE TABLE "role_mapping_rule" ("id" varchar(16) PRIMARY KEY NOT NULL, "expression" text NOT NULL, "role" varchar(128) NOT NULL, "type" varchar(64) NOT NULL, "order" integer NOT NULL, "createdAt" datetime(3) NOT NULL DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')), "updatedAt" datetime(3) NOT NULL DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')), CONSTRAINT "UQ_b33ac896ad3099fc8de36fdc1c4" UNIQUE ("type", "order"), CONSTRAINT "FK_bb66e404c35996b0d6946177501" FOREIGN KEY ("role") REFERENCES "role" ("slug") ON DELETE CASCADE ON UPDATE CASCADE)
```

</details>

## Columns

| Name | Type | Default | Nullable | Children | Parents | Comment |
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| createdAt | datetime(3) | STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW') | false |  |  |  |
| expression | TEXT |  | false |  |  |  |
| id | varchar(16) |  | false | [role_mapping_rule_project](role_mapping_rule_project.md) |  |  |
| order | INTEGER |  | false |  |  |  |
| role | varchar(128) |  | false |  | [role](role.md) |  |
| type | varchar(64) |  | false |  |  |  |
| updatedAt | datetime(3) | STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW') | false |  |  |  |

## Constraints

| Name | Type | Definition |
| ---- | ---- | ---------- |
| - (Foreign key ID: 0) | FOREIGN KEY | FOREIGN KEY (role) REFERENCES role (slug) ON UPDATE CASCADE ON DELETE CASCADE MATCH NONE |
| id | PRIMARY KEY | PRIMARY KEY (id) |
| sqlite_autoindex_role_mapping_rule_1 | PRIMARY KEY | PRIMARY KEY (id) |
| sqlite_autoindex_role_mapping_rule_2 | UNIQUE | UNIQUE (type, order) |

## Indexes

| Name | Definition |
| ---- | ---------- |
| IDX_bb66e404c35996b0d694617750 | CREATE INDEX "IDX_bb66e404c35996b0d694617750" ON "role_mapping_rule" ("role")  |
| sqlite_autoindex_role_mapping_rule_1 | PRIMARY KEY (id) |
| sqlite_autoindex_role_mapping_rule_2 | UNIQUE (type, order) |

## Relations

```mermaid
erDiagram

"role_mapping_rule_project" |o--|| "role_mapping_rule" : "FOREIGN KEY (roleMappingRuleId) REFERENCES role_mapping_rule (id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE"
"role_mapping_rule" }o--|| "role" : "FOREIGN KEY (role) REFERENCES role (slug) ON UPDATE CASCADE ON DELETE CASCADE MATCH NONE"

"role_mapping_rule" {
  datetime_3_ createdAt
  TEXT expression
  varchar_16_ id PK
  INTEGER order
  varchar_128_ role FK
  varchar_64_ type
  datetime_3_ updatedAt
}
"role_mapping_rule_project" {
  varchar_36_ projectId PK
  varchar_16_ roleMappingRuleId PK
}
"role" {
  datetime_3_ createdAt
  TEXT description
  TEXT displayName
  TEXT roleType
  varchar_128_ slug PK
  boolean systemRole
  datetime_3_ updatedAt
}
```

---

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