feat: 투자 소수점 매매 + 카드 할부(installment_months)
CI / build (push) Failing after 13m58s

- invest_trade.quantity BIGINT→DECIMAL(18,6): 평단·원가·평가/실현손익 계산을 BigDecimal로 전환 (금액은 원단위 정수 유지)
- account_entry.installment_months 추가: 카드 지출 2~24개월 할부 기록(일시불 null), 응답에 포함

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ByungCheol
2026-06-03 16:41:58 +09:00
parent f5e9b78a14
commit bd0a0f7776
11 changed files with 79 additions and 28 deletions
+6 -1
View File
@@ -39,6 +39,7 @@ CREATE TABLE IF NOT EXISTS account_entry (
memo VARCHAR(255) NULL,
wallet_id BIGINT NULL COMMENT '발생/출금 계좌(wallet.id)',
to_wallet_id BIGINT NULL COMMENT '이체 입금 계좌(TRANSFER)',
installment_months INT NULL COMMENT '카드 할부 개월수(2~24, 일시불은 NULL)',
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id),
@@ -48,6 +49,7 @@ CREATE TABLE IF NOT EXISTS account_entry (
-- 기존 account_entry 컬럼 추가 (멱등)
ALTER TABLE account_entry ADD COLUMN IF NOT EXISTS wallet_id BIGINT NULL;
ALTER TABLE account_entry ADD COLUMN IF NOT EXISTS to_wallet_id BIGINT NULL;
ALTER TABLE account_entry ADD COLUMN IF NOT EXISTS installment_months INT NULL;
-- 가계부 태그 (사용자별 관리 — 게시판 태그와 분리)
CREATE TABLE IF NOT EXISTS account_tag (
@@ -155,7 +157,7 @@ CREATE TABLE IF NOT EXISTS invest_trade (
holding_id BIGINT NOT NULL COMMENT 'invest_holding.id',
trade_type VARCHAR(10) NOT NULL COMMENT 'BUY / SELL',
trade_date DATE NOT NULL,
quantity BIGINT NOT NULL COMMENT '수량(주)',
quantity DECIMAL(18,6) NOT NULL COMMENT '수량(주, 소수점 매매 지원)',
price BIGINT NOT NULL COMMENT '단가(원)',
fee BIGINT NOT NULL DEFAULT 0 COMMENT '수수료/세금(원)',
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
@@ -163,3 +165,6 @@ CREATE TABLE IF NOT EXISTS invest_trade (
KEY idx_trade_member_holding (member_id, holding_id),
KEY idx_trade_date (holding_id, trade_date, id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- 소수점 매매(예: 해외주식 소수점 매수) 지원: 기존 BIGINT → DECIMAL
ALTER TABLE invest_trade MODIFY COLUMN quantity DECIMAL(18,6) NOT NULL COMMENT '수량(주, 소수점 매매 지원)';