콘텐츠로 이동

ERD mermaid

[!note] 수정이력 | 2026-05-06 19:48, 분홍 (hermes)

  • PostgreSQL 메타데이터 자동 추출 → Mermaid ERD 생성
  • Tables: 24, Columns: 235, FKs: 46, Enums: 17
  • dbdiagram.io용 DBML 파일 함께 생성
  • 소스: docker exec erp-postgres psql 정보스키마 쿼리

erDiagram alembic_version { string version_num PK } companies { uuid id PK string name string business_number string domain text address string phone string email string logo_url json settings subscriptionplan subscription timestamp subscription_expires bool is_active timestamp created_at timestamp updated_at } completion_reports { uuid id PK uuid project_id completion_doc_type type text name text description text file_path uuid uploaded_by timestamp created_at timestamp updated_at } design_document_categories { uuid id PK uuid company_id string name string value bool is_required int sort_order timestamp created_at timestamp updated_at } design_documents { uuid id PK uuid project_id workcategory category text name text description text file_path uuid uploaded_by timestamp created_at timestamp updated_at } documents { uuid id PK uuid project_id completion_doc_type doc_type approvalstatus status json content uuid created_by timestamp created_at timestamp updated_at } inspection_photos { uuid id PK uuid project_id photo_type_enum photo_type text file_path text file_name text description uuid uploaded_by timestamp created_at timestamp updated_at } material_inputs { uuid id PK uuid project_id uuid material_id materialinputtype input_type int quantity uuid input_by teamtype team_type timestamp input_at timestamp created_at } materials { uuid id PK uuid company_id string name string code string unit supplytype supply_type float unit_price bool is_active timestamp created_at timestamp updated_at } ocr_uploads { uuid id PK uuid project_id uuid uploaded_by string file_path json ocr_result uuid reviewed_by reviewstatus review_status timestamp uploaded_at timestamp reviewed_at } plugins { uuid id PK uuid company_id string plugin_key string name bool enabled json config timestamp created_at timestamp updated_at } project_approvals { uuid id PK uuid project_id string approval_status text request_number text construction_number timestamp approved_at uuid approved_by text note timestamp created_at timestamp updated_at } project_stage_logs { uuid id PK uuid project_id stagegroup stage_group string stage_name approvalstatus status text note uuid updated_by timestamp started_at timestamp completed_at timestamp created_at } project_tasks { uuid id PK uuid project_id teamtype team_type string task_name approvalstatus status int sort_order uuid assigned_team_id uuid created_by timestamp created_at timestamp updated_at timestamp completed_at text note } project_teams { uuid id PK uuid project_id uuid user_id teamtype team_type timestamp assigned_at timestamp removed_at } project_type_plugins { uuid id PK uuid project_type_id uuid plugin_id bool enabled } project_type_stages { uuid id PK uuid project_type_id stagegroup stage_group string stage_name int stage_order enum assigned_role teamtype assigned_team_type bool is_required timestamp created_at timestamp updated_at } project_types { uuid id PK uuid company_id string name text description bool is_active timestamp created_at timestamp updated_at string prefix } projects { uuid id PK uuid company_id uuid project_type_id string title text description text location enum current_stage string current_step approvalstatus approval_status uuid agent_id timestamp started_at timestamp completed_at timestamp created_at timestamp updated_at string file_path string file_name projectclassification classification string order_number string origin_number uuid parent_project_id timestamp order_approved_at uuid order_approved_by text caused_by_note workcategory work_category text no_photos_reason int seq_no string prefix uuid supervisor_id uuid created_by } task_templates { uuid id PK uuid project_type_id teamtype team_type string task_name int sort_order bool is_default timestamp created_at timestamp updated_at } users { uuid id PK uuid company_id string name string email string password_hash string phone userrole role teamtype team_type bool is_active timestamp last_login_at timestamp created_at timestamp updated_at string username } viewer_permissions { uuid id PK uuid user_id string page_key bool can_view uuid granted_by } work_types { uuid id PK uuid company_id string name text description bool is_active timestamp created_at timestamp updated_at } works { uuid id PK uuid project_id string work_name string work_code text description teamtype assigned_team_type uuid assigned_user_id int sort_order approvalstatus status timestamp created_at timestamp updated_at timestamp started_at timestamp completed_at text note uuid work_type_id uuid actual_worker_id string review_status text review_note uuid reviewed_by }

users ||--o{ companies : "company_id -> id"
viewer_permissions ||--o{ users : "granted_by -> id"
viewer_permissions ||--o{ users : "user_id -> id"
project_types ||--o{ companies : "company_id -> id"
project_type_stages ||--o{ project_types : "project_type_id -> id"
materials ||--o{ companies : "company_id -> id"
plugins ||--o{ companies : "company_id -> id"
projects ||--o{ users : "agent_id -> id"
projects ||--o{ companies : "company_id -> id"
projects ||--o{ project_types : "project_type_id -> id"
project_teams ||--o{ projects : "project_id -> id"
project_teams ||--o{ users : "user_id -> id"
project_stage_logs ||--o{ projects : "project_id -> id"
project_stage_logs ||--o{ users : "updated_by -> id"
material_inputs ||--o{ users : "input_by -> id"
material_inputs ||--o{ materials : "material_id -> id"
material_inputs ||--o{ projects : "project_id -> id"
project_type_plugins ||--o{ plugins : "plugin_id -> id"
project_type_plugins ||--o{ project_types : "project_type_id -> id"
documents ||--o{ users : "created_by -> id"
documents ||--o{ projects : "project_id -> id"
ocr_uploads ||--o{ projects : "project_id -> id"
ocr_uploads ||--o{ users : "reviewed_by -> id"
ocr_uploads ||--o{ users : "uploaded_by -> id"
works ||--o{ projects : "project_id -> id"
works ||--o{ users : "assigned_user_id -> id"
projects ||--o{ projects : "parent_project_id -> id"
projects ||--o{ users : "order_approved_by -> id"
project_tasks ||--o{ project_teams : "assigned_team_id -> id"
project_tasks ||--o{ users : "created_by -> id"
project_tasks ||--o{ projects : "project_id -> id"
task_templates ||--o{ project_types : "project_type_id -> id"
work_types ||--o{ companies : "company_id -> id"
works ||--o{ work_types : "work_type_id -> id"
works ||--o{ users : "actual_worker_id -> id"
works ||--o{ users : "reviewed_by -> id"
inspection_photos ||--o{ projects : "project_id -> id"
inspection_photos ||--o{ users : "uploaded_by -> id"
design_documents ||--o{ projects : "project_id -> id"
design_documents ||--o{ users : "uploaded_by -> id"
project_approvals ||--o{ projects : "project_id -> id"
project_approvals ||--o{ users : "approved_by -> id"
completion_reports ||--o{ projects : "project_id -> id"
completion_reports ||--o{ users : "uploaded_by -> id"
design_document_categories ||--o{ companies : "company_id -> id"
projects ||--o{ users : "created_by -> id"