Files
Aislo/docs/wiki/concepts/db_schema/structure_output.md
T
eomsangdonandClaude Opus 5 eb30b774f8 chore(docs): docs 폴더 git 추적 전환 · PLAN·OWNERS 최상위 이관
- `docs/` 를 .gitignore 에서 빼 git 추적 대상으로 전환 (위키·완료 이력·검증 기록)
- `docs/raw/PLAN.md` · `docs/raw/OWNERS.md` 를 저장소 최상위로 이동 후 .gitignore 에 등록
  — 창끼리 공유하되 저장소에는 안 올리는 장부
- 살아 있는 경로 참조 7개 파일 정정 (아카이브 107건은 그때 사실이라 그대로 둠)
- graphify 날짜별 산출물(`docs/wiki/graphify-out/20*/`) 제외 — `graphify update` 가 다시 만듦

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-09 18:19:07 +09:00

71 lines
3.7 KiB
Markdown

---
type: concept
status: draft
related_pages: ["[[B07_Quantity/B07_frontend]]", "[[B08_DesignDetail/B08_frontend]]", "[[B09_Estimation/B09_frontend]]", "[[architecture/shared_resources]]"]
last_updated: 2026-07-12
source: raw/guidelines/db_schema.md
---
# DB: 구조물/수량/산출물 테이블
← [[db_schema/overview]]
## structures (배치 구조물)
| 컬럼 | 타입 | Null | Key | Default / Extra |
|---|---|---|---|---|
| `id` | `int(11)` | NO | PRI | `auto_increment` |
| `project_id` / `cross_section_id` | - | - | MUL | FK→projects / cross_sections |
| `structure_type` | `varchar(100)` | YES | | 낙석방지책 / 계간수로 / 돌붙임 등 |
| `chainage_m` | `float` | YES | | 구조물 배치 체인 시점 거리(m) |
| `location` | `varchar(50)` | YES | | 좌 / 우 / 종단 등 배치 위치 |
| `length_m` / `width_m` / `height_m` | `float` | YES | | 길이 / 폭 / 높이 규격(m) |
| `material` | `varchar(100)` | YES | | 구조물 재질/자재 |
| `quantity` / `unit_price` | - | YES | | 수량 / 단가 |
| `design_notes` | `longtext` | YES | | 특기사항 등 메모 |
| `structure_data_path` | `varchar(500)` | YES | | 세부 구조 상세 데이터 파일 경로 |
| `last_modified_by` | `int(11)` | YES | MUL | FK→users.id (최종 수정자) |
| `created_at` / `updated_at` | `timestamp` | - | | 생성 / 수정 일시 |
## quantity_items (수량 산출 항목)
| 컬럼 | 타입 | Null | Key | Default / Extra |
|---|---|---|---|---|
| `id` | `int(11)` | NO | PRI | `auto_increment` |
| `project_id` | `char(36)` | NO | MUL | FK→projects.id |
| `category` | `varchar(100)` | YES | | 토공 / 구조물 / 포장 / 배수 등 공종 |
| `item_name` / `unit` | `varchar` | YES | | 품목 항목명 / 단위 (㎡, m 등) |
| `quantity_design` / `quantity_actual` | `float` | YES | | 설계 수량 / 최종 반영 수량 |
| `unit_price` / `total_price` | `float` | YES | | 단가 / 총 금액 |
| `standard_reference` | `varchar(255)` | YES | | 품셈 근거 코드/출처 |
| `computed_at` / `quantity_data_path` | - | YES | | 계산 일시 / 상세 산출근거 데이터 파일 경로 |
| `data` | `longtext` | YES | | 계산 세부 과정 통계 JSON |
## outputs (최종 견적/도면 산출 세션)
| 컬럼 | 타입 | Null | Key | Default / Extra |
|---|---|---|---|---|
| `id` | `int(11)` | NO | PRI | `auto_increment` |
| `project_id` | `char(36)` | NO | MUL | FK→projects.id |
| `output_type` | `varchar(100)` | YES | | `estimation_excel`/`drawing_dxf`/`report_pdf`/`all_bundle` |
| `status` | `varchar(50)` | YES | | `GENERATING` ➡️ `COMPLETE` / `FAILED` |
| `generated_by` / `generated_at` | - | - | MUL | 생성자 FK / 생성일시 |
| `version` | `int(11)` | YES | | 산출 버전 |
| `outputs_directory_path` | `varchar(500)` | YES | | 산출 파일 번들 디렉토리 경로 |
| `metadata` | `longtext` | YES | | 기타 도면 스케일 등 정보 JSON |
## output_files (개별 산출 파일 리스트)
| 컬럼 | 타입 | Null | Key | Default / Extra |
|---|---|---|---|---|
| `id` | `int(11)` | NO | PRI | `auto_increment` |
| `output_id` | `int(11)` | NO | MUL | FK→outputs.id |
| `file_type` | `varchar(50)` | YES | | `xlsx`/`pdf`/`dxf`/`dwg`/`json`/`zip` 등 |
| `original_filename` | `varchar(255)` | YES | | 원본 파일 식별 이름 |
| `output_file_path` | `varchar(500)` | YES | | 개별 파일 저장 경로 |
| `file_size_mb` / `download_count` | - | YES | | 파일 용량 / 다운로드 누적 카운트 |
| `created_at` | `timestamp` | NO | | 생성일시 |
## quantity_items 총비용 계산 예
```sql
SELECT SUM(quantity_actual * unit_price) AS total_cost, category
FROM quantity_items WHERE project_id = :project_id AND deleted_at IS NULL
GROUP BY category;
```