# invoice_template_items

## 概要

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

```sql
CREATE TABLE `invoice_template_items` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'テンプレート明細ID',
  `template_id` bigint unsigned NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '請求項目名',
  `amount` decimal(12,2) NOT NULL COMMENT '金額（税抜）',
  `tax_category` enum('課税','不課税','非課税') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '課税' COMMENT '税区分',
  `note` text COLLATE utf8mb4_unicode_ci COMMENT '備考',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `invoice_template_items_template_id_foreign` (`template_id`),
  CONSTRAINT `invoice_template_items_template_id_foreign` FOREIGN KEY (`template_id`) REFERENCES `invoice_templates` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
```

</details>

## カラム一覧

| 名前 | タイプ | デフォルト値 | NULL許可 | Extra Definition | 子テーブル | 親テーブル | コメント |
| ---- | ------ | ------------ | -------- | ---------------- | ---------- | ---------- | -------- |
| id | bigint unsigned |  | false | auto_increment |  |  | テンプレート明細ID |
| template_id | bigint unsigned |  | false |  |  | [invoice_templates](invoice_templates.md) |  |
| description | varchar(255) |  | true |  |  |  | 請求項目名 |
| amount | decimal(12,2) |  | false |  |  |  | 金額（税抜） |
| tax_category | enum('課税','不課税','非課税') | 課税 | false |  |  |  | 税区分 |
| note | text |  | true |  |  |  | 備考 |
| created_at | timestamp |  | true |  |  |  |  |
| updated_at | timestamp |  | true |  |  |  |  |

## 制約一覧

| 名前 | タイプ | 定義 |
| ---- | ---- | ---------- |
| invoice_template_items_template_id_foreign | FOREIGN KEY | FOREIGN KEY (template_id) REFERENCES invoice_templates (id) |
| PRIMARY | PRIMARY KEY | PRIMARY KEY (id) |

## INDEX一覧

| 名前 | 定義 |
| ---- | ---------- |
| invoice_template_items_template_id_foreign | KEY invoice_template_items_template_id_foreign (template_id) USING BTREE |
| PRIMARY | PRIMARY KEY (id) USING BTREE |

## ER図

![er](invoice_template_items.svg)

---

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