テーブル定義
作り変えで参照頻度が高い中核テーブルの代表カラムを抜粋します。型・コメントはDBダンプ(value.sql)のスキーマ定義に基づきます。
users(社員/営業マン・38列)
Section titled “users(社員/営業マン・38列)”| カラム | 型 | 意味 |
|---|---|---|
user_type | int | ユーザータイプ(Enum:UserType) |
partner_company_id | int | 加盟店(PartnerCompany) |
name / kana | varchar | 氏名/フリガナ |
email | varchar | メールアドレス(社用) |
company_id / belongs_id / sub_belongs_id | int | 会社/事業部/課 |
employee_post | int | 役職(Enum:EmployeePost) |
employment_type | int | 雇用形態(Enum:EmploymentType) |
entry_date | date | 入社日 |
tfa_token / tfa_expires_at / tfa_is_used / tfa_verified | — | 二段階認証(OTP) |
has_sales_experience | tinyint(1) | 営業経験歴 |
vendor_user_flag | tinyint(1) | ベンダーユーザフラグ |
customers(顧客・42列)
Section titled “customers(顧客・42列)”| カラム | 型 | 意味 |
|---|---|---|
contract_id | bigint | 成約ID |
sales_person_id | int | 営業担当者 |
name / kana / birth_date / age | — | 顧客基本情報 |
email / phone_number / postal_code / prefecture / city / address_line | — | 連絡先・住所 |
current_loan_status | tinyint | 借入状況(Enum:LoanStatus) |
construction_status | varchar | 完工ステータス(Enum:ConstructionStatus) |
order_status | varchar | 発注ステータス |
certification_application_status | varchar | 認定申請ステータス |
defect_resolution_status / defect_content | — | 不備解消ステータス/内容 |
power_selling_start_date | date | 売電開始日 |
construction_shop_id | int | 施工店 |
contracts(契約・58列)
Section titled “contracts(契約・58列)”| カラム | 型 | 意味 |
|---|---|---|
customer_id / telemarketing_appointment_id | bigint | 顧客/アポ |
contract_date | date | ご契約日 |
total_amount | decimal(10,0) | ご提案金額 |
settlement_amount | bigint | 仕切り金額(税込) |
settlement_content | text | 仕切り内容 |
payment_count / down_payment | — | 支払回数/頭金 |
loan_company | tinyint | ローン会社 |
pv_contract / bt_contract / eq_contract / ih_contract / ac_contract | tinyint(1) | 各商材の契約有無 |
survey_datetime_1..3 / survey_datetime_confirmed | datetime | 現地調査日時(候補・確定) |
construction_datetime_1..3 / construction_datetime_confirmed | date | 工事日時(候補・確定) |
thank_you_call / loan_call | datetime | サンキューコール/ローン審査コール日時 |
status / status_changed_at | — | 審査状況/変更日時 |
*_guarantee_application_status(各商材の保証申請ステータス)は contracts のカラムではなく、次項の contract_additional_materials に属します。
contract_additional_materials(契約商材詳細・57列)
Section titled “contract_additional_materials(契約商材詳細・57列)”contracts(58列)とは別テーブルで、契約に紐づく商材(PV/BT/EQ/IH/AC)の型番・容量・保証申請状況を保持します。*_guarantee_application_status はこちらのテーブルのカラムです。
telemarketing_appointments(アポ・商談・43列)
Section titled “telemarketing_appointments(アポ・商談・43列)”| カラム | 型 | 意味 |
|---|---|---|
assigned_staff_id / accompanying_staff_id | bigint | 担当/同行 |
scheduled_visit_datetime | datetime | 訪問予定日時 |
channel | tinyint | チャネル |
branch | tinyint | 取次拠点(Enum:BranchOffice) |
status | tinyint | ステータス(Enum:AppointmentStatus) |
pre_call_result / first_visit_result / talk_result | tinyint | マエカク/初回訪問/商談結果 |
event_date / event_location / event_location_prefectures | — | 催事実施日・店舗・都道府県 |
toss_id | bigint | トスID |
*_calendar_event_id | varchar | Googleカレンダー連携(訪問・マエカク等) |
corporate_number_id | int | 加盟店番号(PartnerCompany) |
customer_progress(顧客進捗・28列)
Section titled “customer_progress(顧客進捗・28列)”着工・完工・入金など、契約後のバックオフィス進捗を管理。
主なカラム:completion_call_datetime(完工コール)、construction_start_date(着工日)、construction_completion_date(完工日=売上計上の起点)、payment_date(入金日)、各種書類の郵送日・追跡番号・格納状況、payment_pattern(決済パターン)。
営業活動レポート3種
Section titled “営業活動レポート3種”| テーブル | チャネル | 代表カラム |
|---|---|---|
operation_reports(29列) | FS訪販 | work_date work_hours visit_count appointment_count company_car_usage usage_branch |
es_reports(21列) | 催事 | event_date lottery_count(抽選)seated_count(着座)appointment_count |
is_reports(17列) | テレマ架電 | call_date call_count effective_call_count toss_count |
マスタの粒度(参考)
Section titled “マスタの粒度(参考)”partner_companies(45列):法人番号・代表者・口座・連帯保証人(乙/丙1/丙2)・販売実績歴・アポクローザー連携加盟店など、加盟店審査に必要な情報を網羅。construction_shops(32列):対応エリア・各種休日・依頼方法・電力情報共有締め日など、施工依頼の運用情報を保持。