84 lines
2.6 KiB
Markdown
84 lines
2.6 KiB
Markdown
|
|
# 078 마이그레이션 실행 가이드
|
||
|
|
|
||
|
|
## 실행할 파일 (순서대로)
|
||
|
|
|
||
|
|
1. **078_create_production_plan_tables.sql** - 테이블 생성
|
||
|
|
2. **078b_insert_production_plan_sample_data.sql** - 샘플 데이터
|
||
|
|
3. **078c_insert_production_plan_screen.sql** - 화면 정의 및 레이아웃
|
||
|
|
|
||
|
|
## 실행 방법
|
||
|
|
|
||
|
|
### 방법 1: psql 명령어 (터미널)
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# 테이블 생성
|
||
|
|
psql -h localhost -U postgres -d wace -f db/migrations/078_create_production_plan_tables.sql
|
||
|
|
|
||
|
|
# 샘플 데이터 입력
|
||
|
|
psql -h localhost -U postgres -d wace -f db/migrations/078b_insert_production_plan_sample_data.sql
|
||
|
|
```
|
||
|
|
|
||
|
|
### 방법 2: DBeaver / pgAdmin에서 실행
|
||
|
|
|
||
|
|
1. DB 연결 후 SQL 에디터 열기
|
||
|
|
2. `078_create_production_plan_tables.sql` 내용 복사 & 실행
|
||
|
|
3. `078b_insert_production_plan_sample_data.sql` 내용 복사 & 실행
|
||
|
|
|
||
|
|
### 방법 3: Docker 환경
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Docker 컨테이너 내부에서 실행
|
||
|
|
docker exec -i <container_name> psql -U postgres -d wace < db/migrations/078_create_production_plan_tables.sql
|
||
|
|
docker exec -i <container_name> psql -U postgres -d wace < db/migrations/078b_insert_production_plan_sample_data.sql
|
||
|
|
```
|
||
|
|
|
||
|
|
## 생성되는 테이블
|
||
|
|
|
||
|
|
| 테이블명 | 설명 |
|
||
|
|
|---------|------|
|
||
|
|
| `equipment_info` | 설비 정보 마스터 |
|
||
|
|
| `production_plan_mng` | 생산계획 관리 |
|
||
|
|
| `production_plan_order_rel` | 생산계획-수주 연결 |
|
||
|
|
|
||
|
|
## 생성되는 화면
|
||
|
|
|
||
|
|
| 화면 | 설명 |
|
||
|
|
|------|------|
|
||
|
|
| 생산계획관리 (메인) | 생산계획 목록 조회/등록/수정/삭제 |
|
||
|
|
| 생산계획 등록/수정 (모달) | 생산계획 상세 입력 폼 |
|
||
|
|
|
||
|
|
## 확인 쿼리
|
||
|
|
|
||
|
|
```sql
|
||
|
|
-- 테이블 생성 확인
|
||
|
|
SELECT table_name FROM information_schema.tables
|
||
|
|
WHERE table_schema = 'public'
|
||
|
|
AND table_name IN ('equipment_info', 'production_plan_mng', 'production_plan_order_rel');
|
||
|
|
|
||
|
|
-- 샘플 데이터 확인
|
||
|
|
SELECT * FROM equipment_info;
|
||
|
|
SELECT * FROM production_plan_mng;
|
||
|
|
|
||
|
|
-- 화면 생성 확인
|
||
|
|
SELECT id, screen_name, screen_code, table_name
|
||
|
|
FROM screen_definitions
|
||
|
|
WHERE screen_code LIKE '%PP%';
|
||
|
|
|
||
|
|
-- 레이아웃 확인
|
||
|
|
SELECT sl.id, sd.screen_name, sl.layout_name
|
||
|
|
FROM screen_layouts_v2 sl
|
||
|
|
JOIN screen_definitions sd ON sl.screen_id = sd.id
|
||
|
|
WHERE sd.screen_code LIKE '%PP%';
|
||
|
|
```
|
||
|
|
|
||
|
|
## 메뉴 연결 (수동 작업 필요)
|
||
|
|
|
||
|
|
화면 생성 후, 메뉴에 연결하려면 `menu_info` 테이블에서 해당 메뉴의 `screen_id`를 업데이트하세요:
|
||
|
|
|
||
|
|
```sql
|
||
|
|
-- 예시: 생산관리 > 생산계획관리 메뉴에 연결
|
||
|
|
UPDATE menu_info
|
||
|
|
SET screen_id = (SELECT id FROM screen_definitions WHERE screen_code = 'TOPSEAL_PP_MAIN')
|
||
|
|
WHERE menu_name = '생산계획관리' AND company_code = 'TOPSEAL';
|
||
|
|
```
|