【注記】 TeamWorks 提供のテーブル定義書(全29テーブル)を
prisma/schema.prisma手書き作成(D-056)のために転記した記録です。3分割の1つです。 当時の記録であり、現行方針ではありません。 定義書には誤記・廃止済み項目が含まれることが実DDL照合で判明しており、以後は実DDLを正とします(D-059)。 現在のスキーマの正はprisma/schema.prisma、経緯はdocs/decisions.mdとdocs/handoff.mdを参照してください。
※本ファイルは TeamWorks 提供のテーブル定義書(Markdown表)からの転記です。定義書に書かれていない内容の補完・推測は行っていません。読み取れない箇所は「読み取れず」と明記しています。 ※定義書では「役割」欄が UI要否・新規作成有無の注記を含んだ1本の文として複数セルに(結合セルの都合で)重複表示されています。以下では、その全文をそのまま「役割:」に記載し、「備考:」にはその中の UI要否/新規作成に関する注記部分を抜き出して重複記載しています(定義書上で別欄として分離されているわけではありません)。
役割: 区画毎の清掃日時を管理する 新規作成 UI: 要 備考: 新規作成 / UI: 要
| # | 論理カラム名 | 物理カラム名 | データ型 | サイズ | 必須 | 初期値 | キー | 備考 |
|---|---|---|---|---|---|---|---|---|
| 1 | 管理ID | id | unsigned bigint | ○ | pk | auto increment | ||
| 2 | 施設ID | facility_id | unsigned bigint | ○ | fk | |||
| 3 | エリアID | section_id | unsigned bigint | ○ | fk | |||
| 4 | スケジュールID | clean_schedule_id | unsigned bigint | ○ | fk | |||
| 5 | 親(本清掃)ID | parent_id | unsigned bigint | ○ | 0 | 親(本清掃)は0を設定, 親以外は親の管理IDを格納する. | ||
| 6 | 清掃開始日時(予定) | start_at | datetime | ○ | idx | 曜日, 開始時間から直近の清掃開始日時を生成し格納する | ||
| 7 | 清掃終了日時(予定) | end_at | datetime | ○ | idx | 曜日, 開始時間から直近の清掃終了日時を生成し格納する | ||
| 8 | 事前確認 | precheck | unsigned tinyint | ○ | 9 | 0: 本清掃, 1; 1回目, 2: 2回目 ... | ||
| 9 | 無効フラグ | inactive | unsigned tinyint | ○ | 0 | 0: 有効, 1: 無効 | ||
| 10 | 登録日時 | created_at | timestamp | ○ | システム日付 | |||
| 11 | 更新日時 | updated_at | timestamp | ○ | システム日付 |
インデックス: | 名称 | タイプ | 対象カラム | |---|---|---| | pk_clean_timetables_id | primary key | id | | fk_clean_timetables_facility_id | foreign key | facility_id | | fk_clean_timetables_section_id | foreign key | secction_id | | fk_clean_timetables_schedule_id | foreign key | clean_schedule_id | | idx_clean_timetables_start_at | index | start_at | | idx_clean_timetables_end_at | index | end_at | | idx_clean_timetables_parent_id | index | parent_id |
※原文注記: インデックス「fk_clean_timetables_section_id」の対象カラムは定義書原文で secction_id と綴られている(タイプミスの可能性。カラム一覧側は section_id)。原文ママ転記。
役割: 清掃日時履歴を管理する 新規作成 UI: 不要 備考: 新規作成 / UI: 不要
| # | 論理カラム名 | 物理カラム名 | データ型 | サイズ | 必須 | 初期値 | キー | 備考 |
|---|---|---|---|---|---|---|---|---|
| 1 | 管理ID | id | unsigned bigint | ○ | uk | |||
| 2 | 施設ID | facility_id | unsigned bigint | ○ | fk | |||
| 3 | エリアID | section_id | unsigned bigint | ○ | fk | |||
| 4 | スケジュールID | clean_schedule_id | unsigned bigint | ○ | fk | |||
| 5 | 親(本清掃)ID | parent_id | unsigned bigint | ○ | idx | |||
| 6 | 清掃開始日時 | start_at | datetime | ○ | idx | 曜日, 開始時間から直近の清掃開始日時を生成し格納する | ||
| 7 | 清掃終了日時 | end_at | datetime | ○ | idx | 曜日, 開始時間から直近の清掃終了日時を生成し格納する | ||
| 8 | 事前確認 | precheck | unsigned tinyint | ○ | 0 | 0: 未設定, 1; 1回目, 2: 2回目 ... 9: 本清掃 | ||
| 9 | 無効フラグ | inactive | unsigned tinyint | ○ | 0 | 0: 有効, 1: 無効 | ||
| 10 | 登録日時 | created_at | timestamp | ○ | システム日付 |
※原文には11番目の「更新日時 updated_at」列は存在しない(clean_timetablesと異なり10番の created_at で終わっている)。原文ママ。
インデックス: | 名称 | タイプ | 対象カラム | |---|---|---| | uk_clean_timetable_histories_id | primary key | id | | fk_clean_timetable_histories_facility_id | foreign key | facility_id | | fk_clean_timetable_histories_section_id | foreign key | section_id | | idx_clean_timetable_histories_started_at | index | started_at | | idx_clean_timetable_histories_ended_at | index | ended_at | | idx_clean_timetable_histories_parent_id | index | parent_id |
※原文注記1: 1件目のインデックス名は uk_...(unique key風の命名)だが、タイプ欄は「primary key」と記載されている。原文ママ。 ※原文注記2: インデックス名 idx_clean_timetable_histories_started_at / ..._ended_at の対象カラムはそれぞれ started_at / ended_at と記載されているが、カラム一覧側の実際の物理カラム名は start_at / end_at であり綴りが一致しない。原文ママ転記。
役割: D-S制御盤 ⇔ 制御サーバ, 制御サーバ ⇔ PuduCloud間の通信間隔を管理する UI: 要 備考: UI: 要
| # | 論理カラム名 | 物理カラム名 | データ型 | サイズ | 必須 | 初期値 | キー | 備考 |
|---|---|---|---|---|---|---|---|---|
| 1 | 管理ID | id | unsigned bigint | ○ | pk | |||
| 2 | エリアID | section_id | unsigned bigint | ○ | fk | |||
| 3 | 通信種類 | type | unsigned tinyint | ○ | 1 | 1: D-S制御盤 ⇔ 制御サーバ, 2: 制御サーバ ⇔ Pudu Cloud | ||
| 4 | 曜日 | weeks | varchar | 7 | ○ | 通信を行う曜日を1, 行わない曜日を0とする。日月火水木金土で設定する。 例) 日火木土に清掃を行う場合 1010101 | ||
| 5 | 報告間隔 | intervals | varchar | 120 | ○ | 報告間隔を秒で指定(設定)する。1~3599で時間毎に設定する。先頭は0時、最後尾は23時を表す。時間の区切りは,(カンマ)とする。 例) 毎時1分毎に報告する場合 60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60 | ||
| 6 | 無効フラグ | inactive | unsigned tinyint | ○ | 0 | 0: 有効, 1: 無効 | ||
| 7 | 登録日時 | created_at | timestamp | ○ | システム日付 | |||
| 8 | 更新日時 | updated_at | timestamp | ○ | システム日付 | |||
| 9 | 削除日時 | deleted_at | timestamp |
インデックス: | 名称 | タイプ | 対象カラム | |---|---|---| | pk_link_schedules_id | primary key | id | | fk_link_schedules_control_id | foreign key | control_id | | (3) | (記載なし) | (記載なし) | | (4) | (記載なし) | (記載なし) | | (5) | (記載なし) | (記載なし) |
※原文注記: インデックス2件目 fk_link_schedules_control_id の対象カラムは control_id とされているが、本テーブルのカラム一覧に control_id は存在しない(存在するのは section_id)。原文ママ転記。インデックス3〜5行は原文でも空欄。
役割: 顧客毎のサマリ情報を格納する 新規作成 UI: 不要 備考: 新規作成 / UI: 不要
| # | 論理カラム名 | 物理カラム名 | データ型 | サイズ | 必須 | 初期値 | キー | 備考 |
|---|---|---|---|---|---|---|---|---|
| 1 | 管理ID | id | unsigned bigint | ○ | pk | auto increment | ||
| 2 | 顧客ID | customer_id | unsigned bigint | ○ | fk | |||
| 3 | 年 | year | unsigned smallint | ○ | idx | |||
| 4 | 月 | month | unsigned tinyint | ○ | idx | 0は年の集計値を表す. | ||
| 5 | 週 | week | unsigned tinyint | ○ | idx | 第1週 1, 第2週 2, 第3週 3, 第4週 4, 第5週 5 0は月の集計値を表す | ||
| 6 | 清掃タスク数 | task_count | unsigned smallint | ○ | ||||
| 7 | 出発成功数 | launch_count | unsigned smallint | ○ | ||||
| 8 | エラー数 | error_count | unsigned smallint | ○ | ||||
| 9 | 総清掃対象面積 | task_area | unsigned decimal | (14, 6) | ○ | |||
| 10 | 総清掃実施面積 | clean_area | unsigned decimal | (14, 6) | ○ | |||
| 11 | 稼働率 | operation_ratio | unsigned tinyint | ○ | 補足を参照. | |||
| 12 | 出発成功率 | launch_ratio | unsigned tinyint | ○ | 補足を参照. | |||
| 13 | 清掃完了率 | clean_ratio | unsigned tinyint | ○ | 補足を参照. | |||
| 14 | エラー発生率 | error_ratio | unsigned tinyint | ○ | 補足を参照. | |||
| 15 | 登録日時 | created_at | timestamp | ○ | システム日付 | |||
| 16 | 更新日時 | updated_at | timestamp | ○ | システム日付 |
インデックス: | 名称 | タイプ | 対象カラム | |---|---|---| | pk_customer_summaries_id | primary key | id | | fk_customer_summaries_customer_id | foreign key | customer_id | | idx_customer_summaries_year | index | year | | idx_customer_summaries_month | index | month | | idx_customer_summaries_week | index | week |
役割: 店舗(施設)毎のサマリ情報を格納する 新規作成 UI: 不要 備考: 新規作成 / UI: 不要
| # | 論理カラム名 | 物理カラム名 | データ型 | サイズ | 必須 | 初期値 | キー | 備考 |
|---|---|---|---|---|---|---|---|---|
| 1 | 管理ID | id | unsigned bigint | ○ | pk | auto increment | ||
| 2 | 施設ID | facility_id | unsigned bigint | ○ | fk | |||
| 3 | 年 | year | unsigned smallint | ○ | idx | |||
| 4 | 月 | month | unsigned tinyint | ○ | idx | 0は年の集計値を表す. | ||
| 5 | 週 | week | unsigned tinyint | ○ | idx | 第1週 1, 第2週 2, 第3週 3, 第4週 4, 第5週 5 0は月の集計値を表す | ||
| 6 | 清掃タスク数 | task_count | unsigned smallint | ○ | ||||
| 7 | 出発成功数 | launch_count | unsigned smallint | ○ | ||||
| 8 | エラー数 | error_count | unsigned smallint | ○ | ||||
| 9 | 総清掃対象面積 | task_area | unsigned decimal | (14, 6) | ○ | |||
| 10 | 総清掃実施面積 | clean_area | unsigned decimal | (14, 6) | ○ | |||
| 11 | 稼働率 | operation_ratio | unsigned tinyint | ○ | 店舗サマリの補足を参照. | |||
| 12 | 出発成功率 | launch_ratio | unsigned tinyint | ○ | 店舗サマリの補足を参照. | |||
| 13 | 清掃完了率 | clean_ratio | unsigned tinyint | ○ | 店舗サマリの補足を参照. | |||
| 14 | エラー発生率 | error_ratio | unsigned tinyint | ○ | 店舗サマリの補足を参照. | |||
| 15 | 登録日時 | created_at | timestamp | ○ | システム日付 | |||
| 16 | 更新日時 | updated_at | timestamp | ○ | システム日付 |
インデックス: | 名称 | タイプ | 対象カラム | |---|---|---| | pk_facility_summaries_id | primary key | id | | fk_facility_summaries_facility_id | foreign key | facility_id | | idx_facility_summaries_year | index | year | | idx_facility_summaries_month | index | month | | idx_facility_summaries_week | index | week |
※customer_summaries と facility_summaries はカラム構成上の差分なし(id部分が customer_id / facility_id に置き換わる以外は同一)。ratio系4カラムの備考は customer_summaries 側「補足を参照.」、facility_summaries 側「店舗サマリの補足を参照.」と文言が異なる(原文ママ)。いずれも参照先の「補足」本文は本抜粋範囲に含まれておらず、比率の計算式(分子/分母の組み合わせ)そのものは読み取れず。
役割: 顧客毎の障害サマリ情報を格納する 新規作成 UI: 不要 備考: 新規作成 / UI: 不要
| # | 論理カラム名 | 物理カラム名 | データ型 | サイズ | 必須 | 初期値 | キー | 備考 |
|---|---|---|---|---|---|---|---|---|
| 1 | 管理ID | id | unsigned bigint | ○ | pk | auto increment | ||
| 2 | 顧客ID | customer_id | unsigned bigint | ○ | fk | |||
| 3 | 年 | year | unsigned smallint | ○ | idx | |||
| 4 | 月 | month | unsigned tinyint | ○ | idx | 0は年の集計値を表す. | ||
| 5 | 週 | week | unsigned tinyint | ○ | idx | 第1週 1, 第2週 2, 第3週 3, 第4週 4, 第5週 5 0は月の集計値を表す | ||
| 6 | 障害レベル | error_level | varchar | 20 | ○ | |||
| 7 | 障害種別 | error_type | varchar | 100 | ○ | |||
| 8 | 障害詳細 | error_detail | text | ○ | ||||
| 9 | エラー数 | error_count | unsigned smallint | ○ | ||||
| 10 | 登録日時 | created_at | timestamp | ○ | システム日付 |
※原文には「更新日時 updated_at」列は存在しない(10番の created_at で終わっている)。原文ママ。
インデックス: | 名称 | タイプ | 対象カラム | |---|---|---| | pk_customer_error_summaries_id | primary key | id | | fk_customer_error_summaries_customer_id | foreign key | customer_id | | idx_customer_error_summaries_year | index | year | | idx_customer_error_summaries_month | index | month | | idx_customer_error_summaries_week | index | week |
役割: 店舗毎の障害サマリ情報を格納する 新規作成 UI: 不要 備考: 新規作成 / UI: 不要
| # | 論理カラム名 | 物理カラム名 | データ型 | サイズ | 必須 | 初期値 | キー | 備考 |
|---|---|---|---|---|---|---|---|---|
| 1 | 管理ID | id | unsigned bigint | ○ | pk | auto increment | ||
| 2 | 施設ID | facility_id | unsigned bigint | ○ | fk | |||
| 3 | 年 | year | unsigned smallint | ○ | idx | |||
| 4 | 月 | month | unsigned tinyint | ○ | idx | 0は年の集計値を表す. | ||
| 5 | 週 | week | unsigned tinyint | ○ | idx | 第1週 1, 第2週 2, 第3週 3, 第4週 4, 第5週 5 0は月の集計値を表す | ||
| 6 | 障害レベル | error_level | varchar | 20 | ○ | |||
| 7 | 障害種別 | error_type | varchar | 100 | ○ | |||
| 8 | 障害詳細 | error_detail | text | ○ | ||||
| 9 | エラー数 | error_count | unsigned smallint | ○ | ||||
| 10 | 登録日時 | created_at | timestamp | ○ | システム日付 |
※原文には「更新日時 updated_at」列は存在しない(10番の created_at で終わっている)。原文ママ。
インデックス: | 名称 | タイプ | 対象カラム | |---|---|---| | pk_facility_error_summaries_id | primary key | id | | fk_facility_error_summaries_facility_id | foreign key | facility_id | | idx_facility_error_summaries_year | index | year | | idx_facility_error_summaries_month | index | month | | idx_facility_error_summaries_week | index | week |
※customer_error_summaries と facility_error_summaries はカラム構成上の差分なし(id部分が customer_id / facility_id に置き換わる以外は同一)。 ※重要: 両テーブルとも「エラー種別ごとの件数カラム」を個別カラムとして持つ設計ではなく、1行=1障害種別のレコードとして error_level(varchar20)・error_type(varchar100)・error_detail(text)・error_count(unsigned smallint)という汎用カラム構成になっている。error_type の具体的な値一覧(列挙)は定義書のこの範囲には記載されておらず、ハンドルアップ・LostLocation・オフライン・ブラシエラー・緊急停止・充電不足・その他の7分類に対応するかどうかは読み取れず。
役割: 異常等の通知方法情報を格納する. 新規作成 UI: 要 備考: 新規作成 / UI: 要
| # | 論理カラム名 | 物理カラム名 | データ型 | サイズ | 必須 | 初期値 | キー | 備考 |
|---|---|---|---|---|---|---|---|---|
| 1 | 管理ID | id | unsigned bigint | ○ | pk | auto increment | ||
| 2 | 顧客ID | customer_id | unsigned bigint | ○ | fk | |||
| 3 | 連絡(通知)方法 | contact_type | unsigned bigint | ○ | 0: 未設定, 1: Slack, 2: メール, 3: Teams | |||
| 4 | URL | url | varchar | 200 | Slack/TeamsのWebHoolURLを想定 | |||
| 5 | メールアドレス | varchar | 100 | 送信先メールアドレスを想定 | ||||
| 6 | 無効フラグ | inactive | unsigned tinyint | ○ | 0 | 0: 有効, 1: 無効 | ||
| 7 | 登録日時 | created_at | timestamp | ○ | システム日付 | |||
| 8 | 更新日時 | updated_at | timestamp | ○ | システム日付 | |||
| 9 | 削除日時 | deleted_at | timestamp |
インデックス: | 名称 | タイプ | 対象カラム | |---|---|---| | pk_customer_contacts_id | primary key | id | | fk_customer_contacts_customer_id | foreign key | customer_id | | (3) | (記載なし) | (記載なし) | | (4) | (記載なし) | (記載なし) | | (5) | (記載なし) | (記載なし) |
※原文注記: 4番カラムの備考は原文でも「Slack/TeamsのWebHoolURLを想定」と記載されている(WebHookのタイプミスと思われるが原文ママ転記)。
役割: 異常等の通知方法情報を格納する. 新規作成 UI: 要 備考: 新規作成 / UI: 要
| # | 論理カラム名 | 物理カラム名 | データ型 | サイズ | 必須 | 初期値 | キー | 備考 |
|---|---|---|---|---|---|---|---|---|
| 1 | 管理ID | id | unsigned bigint | ○ | pk | auto increment | ||
| 2 | 施設ID | facility_id | unsigned bigint | ○ | fk | |||
| 3 | 連絡(通知)方法 | contact_type | unsigned tinyint | ○ | 0: 未設定, 1: Slack, 2: メール, 3: Teams | |||
| 4 | URL | url | varchar | 200 | Slack/TeamsのWebHoolURLを想定 | |||
| 5 | メールアドレス | varchar | 255 | 送信先メールアドレスを想定 | ||||
| 6 | 無効フラグ | inactive | unsigned tinyint | ○ | 0 | 0: 有効, 1: 無効 | ||
| 7 | 登録日時 | created_at | timestamp | ○ | システム日付 | |||
| 8 | 更新日時 | updated_at | timestamp | ○ | システム日付 | |||
| 9 | 削除日時 | deleted_at | timestamp |
インデックス: | 名称 | タイプ | 対象カラム | |---|---|---| | pk_facility_contacts_id | primary key | id | | fk_facility_contacts_facility_id | foreign key | facility_id | | (3) | (記載なし) | (記載なし) | | (4) | (記載なし) | (記載なし) | | (5) | (記載なし) | (記載なし) |
※customer_contacts と facility_contacts の差分:
contact_type のデータ型が customer_contacts は unsigned bigint、facility_contacts は unsigned tinyint と異なる(いずれも値は 0〜3 の列挙で、原文のまま。データ型不一致は原文の記載差)。email のサイズが customer_contacts は 100、facility_contacts は 255 と異なる(原文ママ)。21〜29番の9テーブル(clean_timetables, clean_timetable_histories, link_schedules, customer_summaries, facility_summaries, customer_error_summaries, facility_error_summaries, customer_contacts, facility_contacts)すべてについて、カラム一覧・インデックス一覧を転記済み。
operation_ratio)・出発成功率(launch_ratio)・清掃完了率(clean_ratio)・エラー発生率(error_ratio)の4カラムが計算済みの結果値としてそのまま存在する。task_count(清掃タスク数)・launch_count(出発成功数)・error_count(エラー数)・task_area(総清掃対象面積)・clean_area(総清掃実施面積)の5つが存在する。task_count なのか、それとも予定清掃回数を表す別カラムなのか」等は本抜粋だけでは特定不可。error_level(障害レベル, varchar20)・error_type(障害種別, varchar100)・error_detail(障害詳細, text)・error_count(エラー数, unsigned smallint)という汎用4カラムで、1行=1エラー種別×期間の集計行を表す設計になっている。error_type に入る具体的な値の列挙(例: ハンドルアップ/LostLocation/オフライン/ブラシエラー/緊急停止/充電不足/その他)は本抜粋には記載がなく、7分類と一致するかどうかは読み取れず。contact_type は 0〜3(未設定/Slack/メール/Teams)と定義書に明記されているのと対照的に、error_type 側には列挙値の記載がない。year(unsigned smallint)・month(unsigned tinyint)・week(unsigned tinyint)の3カラムで期間を表現している。month は「0は年の集計値を表す.」、week は「第1週 1, 第2週 2, 第3週 3, 第4週 4, 第5週 5 0は月の集計値を表す」。
precheck(事前確認)カラムの初期値とコード値の対応がテーブル間で逆転しているように見える:
9、備考「0: 本清掃, 1; 1回目, 2: 2回目 ...」(0が本清掃の意味に読める)0、備考「0: 未設定, 1; 1回目, 2: 2回目 ... 9: 本清掃」(0は未設定、9が本清掃の意味)fk_clean_timetables_section_id の対象カラムが secction_id と綴られている(カラム一覧側は section_id)。uk_clean_timetable_histories_id (uk=unique key風)なのにタイプ欄は「primary key」と記載。started_at / ended_at と記載されているが、実際のカラム一覧では start_at / end_at(startedではなくstart)であり綴りが一致しない。updated_at カラムが存在しない(clean_timetablesにはある)。履歴テーブルゆえ意図的と思われるが、定義書上に明記の理由記載はなし。fk_link_schedules_control_id の対象カラムが control_id とされているが、本テーブルのカラム一覧に control_id は存在しない(存在するのは section_id のみ)。インデックス3〜5行は空欄。updated_at カラムが存在しない(created_at のみ)。contact_type は unsigned bigint、facility_contacts の contact_type は unsigned tinyint と、同じ用途(0〜3の列挙値)にもかかわらずデータ型が異なる。email サイズは varchar(100)、facility_contacts の email サイズは varchar(255) と異なる。url 備考「Slack/TeamsのWebHoolURLを想定」は、原文ですでに "WebHool" という綴り(WebHookのタイプミスと推測されるが未修正で転記)。このファイル(03-schedule-summary.md)は338行(セクション見出し・表・報告部分を含む全体、wc -l による実測値)。