From 1068b3d0a2461365dc8012a54207266bf082f732 Mon Sep 17 00:00:00 2001 From: happybell80 Date: Wed, 15 Oct 2025 18:24:24 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20Slack=20=EB=B4=87=20=EC=84=A4=EC=B9=98?= =?UTF-8?q?=20workspace=5Fid=20=EC=BB=AC=EB=9F=BC=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=ED=8A=B8=EB=9F=AC=EB=B8=94=EC=8A=88=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: workspace_member 테이블에 존재하지 않는 workspace_id 컬럼 조회 시도 원인: DB 스키마 변경 후 slack.py:408-413 쿼리 미반영 해결: user.team_id 직접 조회로 수정 필요 (로컬 개발자) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- ...251015_slack_install_workspace_id_error.md | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 troubleshooting/251015_slack_install_workspace_id_error.md diff --git a/troubleshooting/251015_slack_install_workspace_id_error.md b/troubleshooting/251015_slack_install_workspace_id_error.md new file mode 100644 index 0000000..cced1a0 --- /dev/null +++ b/troubleshooting/251015_slack_install_workspace_id_error.md @@ -0,0 +1,54 @@ +# Slack 봇 설치 workspace_id 컬럼 오류 + +**날짜**: 2025-10-15 +**작성자**: 51123 서버 관리자 +**관련 파일**: `auth-server/app/providers/slack.py:408-418` + +--- + +## 문제 상황 + +Slack 연동 버튼 클릭 시 Internal Server Error: +``` +column "workspace_id" does not exist +LINE 2: SELECT workspace_id + FROM workspace_member +``` + +**에러 로그**: auth-server 로그에서 sqlalchemy.exc.ProgrammingError 확인 + +## 원인 분석 + +### DB 구조 +- workspace_member 테이블: workspace_id 컬럼 없음 (id, user_id, role, is_active만 존재) +- slack.py:408-413: 존재하지 않는 컬럼 조회 시도 + +### 실제 관계 +- user.team_id → team.id +- Workspace = Team (workspace.py:113) +- user.team_id가 workspace_id 역할 + +## 해결 방안 + +**로컬 개발자 수정 필요**: slack.py:407-423 + +- slack.py:408-413: workspace_member 쿼리 제거 +- user.team_id 직접 조회로 변경 +- User 모델 import 추가 필요 (app.models.user) + +## 교훈 + +### DB 스키마 검증 누락 +- workspace_member.workspace_id 존재 가정 +- 실제 테이블 구조 미확인 +- 교훈: 쿼리 작성 전 \d 명령으로 테이블 구조 확인 필수 + +### 스키마 변경 후 코드 미반영 +- Git 히스토리: 9월 workspace 관련 수정 다수 (커밋 455af87, 59ae0ab) +- DB 스키마 변경 후 참조 쿼리 미검증 +- 교훈: 스키마 변경 시 Grep으로 전체 참조 검색 후 일괄 수정 + +### 중간 테이블 설계 오류 +- workspace_member에 workspace/team FK 누락 +- user.team_id로 직접 조회해야 하는 구조 +- 교훈: 다대다 중간 테이블은 양쪽 FK 필수