# invoice_templates

## 概要

<details>
<summary><strong>テーブル定義</strong></summary>

```sql
CREATE TABLE `invoice_templates` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'テンプレートID',
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'テンプレート名',
  `company_id` bigint unsigned DEFAULT NULL,
  `trainee_id` bigint unsigned DEFAULT NULL,
  `note` text COLLATE utf8mb4_unicode_ci COMMENT '備考',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `invoice_templates_company_id_foreign` (`company_id`),
  KEY `invoice_templates_trainee_id_foreign` (`trainee_id`),
  CONSTRAINT `invoice_templates_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`) ON DELETE SET NULL,
  CONSTRAINT `invoice_templates_trainee_id_foreign` FOREIGN KEY (`trainee_id`) REFERENCES `trainees` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
```

</details>

## カラム一覧

| 名前 | タイプ | デフォルト値 | NULL許可 | Extra Definition | 子テーブル | 親テーブル | コメント |
| ---- | ------ | ------------ | -------- | ---------------- | ---------- | ---------- | -------- |
| id | bigint unsigned |  | false | auto_increment | [invoice_template_items](invoice_template_items.md) |  | テンプレートID |
| name | varchar(255) |  | false |  |  |  | テンプレート名 |
| company_id | bigint unsigned |  | true |  |  | [companies](companies.md) |  |
| trainee_id | bigint unsigned |  | true |  |  | [trainees](trainees.md) |  |
| note | text |  | true |  |  |  | 備考 |
| created_at | timestamp |  | true |  |  |  |  |
| updated_at | timestamp |  | true |  |  |  |  |

## 制約一覧

| 名前 | タイプ | 定義 |
| ---- | ---- | ---------- |
| invoice_templates_company_id_foreign | FOREIGN KEY | FOREIGN KEY (company_id) REFERENCES companies (id) |
| invoice_templates_trainee_id_foreign | FOREIGN KEY | FOREIGN KEY (trainee_id) REFERENCES trainees (id) |
| PRIMARY | PRIMARY KEY | PRIMARY KEY (id) |

## INDEX一覧

| 名前 | 定義 |
| ---- | ---------- |
| invoice_templates_company_id_foreign | KEY invoice_templates_company_id_foreign (company_id) USING BTREE |
| invoice_templates_trainee_id_foreign | KEY invoice_templates_trainee_id_foreign (trainee_id) USING BTREE |
| PRIMARY | PRIMARY KEY (id) USING BTREE |

## ER図

![er](invoice_templates.svg)

---

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