sw아키텍처

테이블 (14)

approval_actions

  • id — BIGINT
  • document_id — BIGINT — 외래 키 → approval_documents.id — NOT NULL
  • actor_id — BIGINT — 외래 키 → users.id — NOT NULL
  • action_type — VARCHAR(30) — NOT NULL
  • reason — TEXT
  • auth_required — BOOLEAN — NOT NULL
  • auth_result — VARCHAR(20)
  • created_at — TIMESTAMP — NOT NULL

approval_documents

  • id — BIGINT
  • document_no — VARCHAR(50) — NOT NULL
  • writer_id — BIGINT — 외래 키 → users.id — NOT NULL
  • form_id — BIGINT — 외래 키 → approval_forms.id — NOT NULL
  • title — VARCHAR(200) — NOT NULL
  • content — TEXT — NOT NULL
  • status — VARCHAR(30) — NOT NULL
  • risk_level — VARCHAR(20) — NOT NULL
  • current_step — INT — NOT NULL
  • version — INT — NOT NULL
  • submitted_at — TIMESTAMP
  • completed_at — TIMESTAMP
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

approval_forms

  • id — BIGINT
  • department_id — BIGINT — 외래 키 → departments.id — NOT NULL
  • name — VARCHAR(100) — NOT NULL
  • description — TEXT
  • risk_default — VARCHAR(20) — NOT NULL
  • is_active — BOOLEAN — NOT NULL
  • created_by — BIGINT — 외래 키 → users.id — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

approval_line_templates

  • id — BIGINT
  • form_id — BIGINT — 외래 키 → approval_forms.id — NOT NULL
  • step_order — INT — NOT NULL
  • required_position — VARCHAR(50)
  • required_job_title — VARCHAR(50)
  • line_type — VARCHAR(20) — NOT NULL
  • approval_method — VARCHAR(20) — NOT NULL
  • is_required — BOOLEAN — NOT NULL

approval_lines

  • id — BIGINT
  • document_id — BIGINT — 외래 키 → approval_documents.id — NOT NULL
  • approver_id — BIGINT — 외래 키 → users.id — NOT NULL
  • step_order — INT — NOT NULL
  • line_type — VARCHAR(20) — NOT NULL
  • approval_method — VARCHAR(20) — NOT NULL
  • status — VARCHAR(20) — NOT NULL
  • first_viewed_at — TIMESTAMP
  • acted_at — TIMESTAMP

attachments

  • id — BIGINT
  • document_id — BIGINT — 외래 키 → approval_documents.id — NOT NULL
  • file_name — VARCHAR(255) — NOT NULL
  • file_path — VARCHAR(500) — NOT NULL
  • file_type — VARCHAR(50) — NOT NULL
  • ocr_status — VARCHAR(20) — NOT NULL
  • ocr_text — TEXT
  • uploaded_at — TIMESTAMP — NOT NULL

audit_logs

  • id — BIGINT
  • user_id — BIGINT — 외래 키 → users.id — NOT NULL
  • document_id — BIGINT — 외래 키 → approval_documents.id
  • action — VARCHAR(50) — NOT NULL
  • detail — TEXT
  • created_at — TIMESTAMP — NOT NULL

departments

  • id — BIGINT
  • parent_id — BIGINT — 외래 키 → departments.id
  • name — VARCHAR(100) — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

document_versions

  • id — BIGINT
  • document_id — BIGINT — 외래 키 → approval_documents.id — NOT NULL
  • version_no — INT — NOT NULL
  • title_snapshot — VARCHAR(200) — NOT NULL
  • content_snapshot — TEXT — NOT NULL
  • changed_by — BIGINT — 외래 키 → users.id — NOT NULL
  • change_reason — TEXT
  • created_at — TIMESTAMP — NOT NULL

notifications

  • id — BIGINT
  • user_id — BIGINT — 외래 키 → users.id — NOT NULL
  • document_id — BIGINT — 외래 키 → approval_documents.id — NOT NULL
  • type — VARCHAR(30) — NOT NULL
  • message — VARCHAR(255) — NOT NULL
  • is_read — BOOLEAN — NOT NULL
  • created_at — TIMESTAMP — NOT NULL

risk_rules

  • id — BIGINT
  • department_id — BIGINT — 외래 키 → departments.id — NOT NULL
  • form_id — BIGINT — 외래 키 → approval_forms.id — NOT NULL
  • condition_type — VARCHAR(50) — NOT NULL
  • condition_operator — VARCHAR(20)
  • condition_value — VARCHAR(100) — NOT NULL
  • risk_level — VARCHAR(20) — NOT NULL
  • created_by — BIGINT — 외래 키 → users.id — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL

roles

  • id — BIGINT
  • code — VARCHAR(50) — NOT NULL
  • name — VARCHAR(100) — NOT NULL
  • description — TEXT

user_roles

  • id — BIGINT
  • user_id — BIGINT — 외래 키 → users.id — NOT NULL
  • role_id — BIGINT — 외래 키 → roles.id — NOT NULL
  • department_id — BIGINT — 외래 키 → departments.id
  • created_at — TIMESTAMP — NOT NULL

users

  • id — BIGINT
  • email — VARCHAR(100) — NOT NULL
  • password_hash — VARCHAR(255) — NOT NULL
  • name — VARCHAR(50) — NOT NULL
  • department_id — BIGINT — 외래 키 → departments.id — NOT NULL
  • position — VARCHAR(50) — NOT NULL
  • job_title — VARCHAR(50)
  • status — VARCHAR(20) — NOT NULL
  • created_at — TIMESTAMP — NOT NULL
  • updated_at — TIMESTAMP — NOT NULL