# git_connection

## Description

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

```sql
CREATE TABLE "git_connection" ("id" varchar(36) PRIMARY KEY NOT NULL, "name" varchar(128) NOT NULL, "repositoryUrl" text NOT NULL, "branchName" varchar(255), "connectionType" varchar(16) NOT NULL, "publicKey" text, "encryptedPrivateKey" text, "encryptedUsername" text, "encryptedPassword" text, "keyGeneratorType" varchar(16), "baseCommit" varchar(64), "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 "CHK_git_connection_ssh_auth" CHECK ("connectionType" <> 'ssh' OR ("encryptedUsername" IS NULL AND "encryptedPassword" IS NULL)), CONSTRAINT "CHK_git_connection_https_auth" CHECK ("connectionType" <> 'https' OR ("publicKey" IS NULL AND "encryptedPrivateKey" IS NULL AND "keyGeneratorType" IS NULL)), CONSTRAINT "CHK_git_connection_connectionType" CHECK ("connectionType" IN ('ssh', 'https')), CONSTRAINT "CHK_git_connection_keyGeneratorType" CHECK ("keyGeneratorType" IN ('ed25519', 'rsa')))
```

</details>

## Columns

| Name | Type | Default | Nullable | Children | Parents | Comment |
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| baseCommit | varchar(64) |  | true |  |  |  |
| branchName | varchar(255) |  | true |  |  |  |
| connectionType | varchar(16) |  | false |  |  |  |
| createdAt | datetime(3) | STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW') | false |  |  |  |
| encryptedPassword | TEXT |  | true |  |  |  |
| encryptedPrivateKey | TEXT |  | true |  |  |  |
| encryptedUsername | TEXT |  | true |  |  |  |
| id | varchar(36) |  | false | [git_connection_project](git_connection_project.md) |  |  |
| keyGeneratorType | varchar(16) |  | true |  |  |  |
| name | varchar(128) |  | false |  |  |  |
| publicKey | TEXT |  | true |  |  |  |
| repositoryUrl | TEXT |  | false |  |  |  |
| updatedAt | datetime(3) | STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW') | false |  |  |  |

## Constraints

| Name | Type | Definition |
| ---- | ---- | ---------- |
| - | CHECK | CHECK ("connectionType" <> 'ssh' OR ("encryptedUsername" IS NULL AND "encryptedPassword" IS NULL)) |
| - | CHECK | CHECK ("connectionType" <> 'https' OR ("publicKey" IS NULL AND "encryptedPrivateKey" IS NULL AND "keyGeneratorType" IS NULL)) |
| - | CHECK | CHECK ("connectionType" IN ('ssh', 'https')) |
| - | CHECK | CHECK ("keyGeneratorType" IN ('ed25519', 'rsa')) |
| id | PRIMARY KEY | PRIMARY KEY (id) |
| sqlite_autoindex_git_connection_1 | PRIMARY KEY | PRIMARY KEY (id) |

## Indexes

| Name | Definition |
| ---- | ---------- |
| sqlite_autoindex_git_connection_1 | PRIMARY KEY (id) |

## Relations

```mermaid
erDiagram

"git_connection_project" }o--|| "git_connection" : "FOREIGN KEY (gitConnectionId) REFERENCES git_connection (id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE"

"git_connection" {
  varchar_64_ baseCommit
  varchar_255_ branchName
  varchar_16_ connectionType
  datetime_3_ createdAt
  TEXT encryptedPassword
  TEXT encryptedPrivateKey
  TEXT encryptedUsername
  varchar_36_ id PK
  varchar_16_ keyGeneratorType
  varchar_128_ name
  TEXT publicKey
  TEXT repositoryUrl
  datetime_3_ updatedAt
}
"git_connection_project" {
  datetime_3_ createdAt
  varchar_36_ gitConnectionId FK
  varchar_36_ projectId PK
  datetime_3_ updatedAt
}
```

---

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