- parent_id 추가(CREATE + ALTER IF NOT EXISTS 멱등 마이그레이션) - 도메인/DTO/매퍼에 parentId 노출, 2단계 검증(대분류 아래만 소분류) - 자식 있는 대분류는 소분류화·삭제 차단(countChildren) - 통계/예산/내역은 소분류 이름 기준 그대로(무변경) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -104,12 +104,16 @@ CREATE TABLE IF NOT EXISTS account_category (
|
||||
member_id BIGINT NOT NULL COMMENT '소유자 member.id',
|
||||
type VARCHAR(10) NOT NULL COMMENT 'INCOME / EXPENSE',
|
||||
name VARCHAR(50) NOT NULL,
|
||||
parent_id BIGINT NULL COMMENT '대분류 id(account_category.id). NULL=대분류, 값=소분류',
|
||||
sort_order INT NOT NULL DEFAULT 0,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_category_member_type_name (member_id, type, name)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- 대/소분류 계층 추가(기존 DB 마이그레이션) — 소분류 이름은 그대로, parent_id 만 부여
|
||||
ALTER TABLE account_category ADD COLUMN IF NOT EXISTS parent_id BIGINT NULL COMMENT '대분류 id. NULL=대분류, 값=소분류';
|
||||
|
||||
-- 예산 (사용자별, 카테고리별)
|
||||
-- fixed=1(고정): base_unit/base_amount 로 일수기준 환산 / fixed=0(비고정): daily/weekly/monthly/yearly 직접
|
||||
CREATE TABLE IF NOT EXISTS budget (
|
||||
|
||||
Reference in New Issue
Block a user