# public.variables

## Columns

| Name | Type | Default | Nullable | Children | Parents | Comment |
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| id | varchar(36) |  | false |  |  |  |
| key | varchar(50) |  | false |  |  |  |
| projectId | varchar(36) |  | true |  | [public.project](public.project.md) |  |
| type | varchar(50) | 'string'::character varying | false |  |  |  |
| value | text |  | true |  |  |  |

## Constraints

| Name | Type | Definition |
| ---- | ---- | ---------- |
| FK_42f6c766f9f9d2edcc15bdd6e9b | FOREIGN KEY | FOREIGN KEY ("projectId") REFERENCES project(id) ON DELETE CASCADE |
| variables_id_not_null1 | n | NOT NULL id |
| variables_key_not_null | n | NOT NULL key |
| variables_pkey | PRIMARY KEY | PRIMARY KEY (id) |
| variables_type_not_null | n | NOT NULL type |
| variables_value_max_len | CHECK | CHECK (((value IS NULL) OR (char_length(value) <= 1000))) |

## Indexes

| Name | Definition |
| ---- | ---------- |
| variables_global_key_unique | CREATE UNIQUE INDEX variables_global_key_unique ON public.variables USING btree (key) WHERE ("projectId" IS NULL) |
| variables_pkey | CREATE UNIQUE INDEX variables_pkey ON public.variables USING btree (id) |
| variables_project_key_unique | CREATE UNIQUE INDEX variables_project_key_unique ON public.variables USING btree ("projectId", key) WHERE ("projectId" IS NOT NULL) |

## Relations

```mermaid
erDiagram

"public.variables" }o--o| "public.project" : "FOREIGN KEY (#quot;projectId#quot;) REFERENCES project(id) ON DELETE CASCADE"

"public.variables" {
  varchar_36_ id
  varchar_50_ key
  varchar_36_ projectId FK
  varchar_50_ type
  text value
}
"public.project" {
  timestamp_3__with_time_zone createdAt
  uuid creatorId FK
  json customTelemetryTags
  varchar_512_ description
  json icon
  varchar_36_ id
  varchar_255_ name
  varchar_36_ type
  timestamp_3__with_time_zone updatedAt
}
```

---

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