# archive_logs

## 概要

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

```sql
CREATE TABLE `archive_logs` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'アーカイブログID',
  `trainee_id` bigint unsigned NOT NULL,
  `archived_at` datetime DEFAULT NULL COMMENT 'アーカイブ日時',
  `reason` text COLLATE utf8mb4_unicode_ci COMMENT 'アーカイブ理由',
  `archived_by` bigint unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `archive_logs_trainee_id_foreign` (`trainee_id`),
  KEY `archive_logs_archived_by_foreign` (`archived_by`),
  CONSTRAINT `archive_logs_archived_by_foreign` FOREIGN KEY (`archived_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `archive_logs_trainee_id_foreign` FOREIGN KEY (`trainee_id`) REFERENCES `trainees` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
```

</details>

## カラム一覧

| 名前 | タイプ | デフォルト値 | NULL許可 | Extra Definition | 子テーブル | 親テーブル | コメント |
| ---- | ------ | ------------ | -------- | ---------------- | ---------- | ---------- | -------- |
| id | bigint unsigned |  | false | auto_increment |  |  | アーカイブログID |
| trainee_id | bigint unsigned |  | false |  |  | [trainees](trainees.md) |  |
| archived_at | datetime |  | true |  |  |  | アーカイブ日時 |
| reason | text |  | true |  |  |  | アーカイブ理由 |
| archived_by | bigint unsigned |  | true |  |  | [users](users.md) |  |
| created_at | timestamp |  | true |  |  |  |  |
| updated_at | timestamp |  | true |  |  |  |  |

## 制約一覧

| 名前 | タイプ | 定義 |
| ---- | ---- | ---------- |
| archive_logs_archived_by_foreign | FOREIGN KEY | FOREIGN KEY (archived_by) REFERENCES users (id) |
| archive_logs_trainee_id_foreign | FOREIGN KEY | FOREIGN KEY (trainee_id) REFERENCES trainees (id) |
| PRIMARY | PRIMARY KEY | PRIMARY KEY (id) |

## INDEX一覧

| 名前 | 定義 |
| ---- | ---------- |
| archive_logs_archived_by_foreign | KEY archive_logs_archived_by_foreign (archived_by) USING BTREE |
| archive_logs_trainee_id_foreign | KEY archive_logs_trainee_id_foreign (trainee_id) USING BTREE |
| PRIMARY | PRIMARY KEY (id) USING BTREE |

## ER図

![er](archive_logs.svg)

---

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