refactor: simplify pricing tables to USD-only

- Remove KRW pricing calculations from all pricing tables
- Simplify pricing table to store only wholesale USD prices
- Simplify anvil_pricing to store only retail USD prices
- Remove KRW environment variables (KRW_EXCHANGE_RATE, KRW_MARGIN_RATE)
- Remove KRW functions from constants.ts
- Update GPU/G8/VPU pricing repositories to match
- Add Anvil tables and repositories for branded product support

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
kappa
2026-01-25 21:16:25 +09:00
parent a2133ae5c9
commit 9f3d3a245a
21 changed files with 1952 additions and 197 deletions

View File

@@ -0,0 +1,60 @@
-- Migration 003: Add Retail Pricing Fields
-- Description: Add hourly_price_retail and monthly_price_retail to all pricing tables
-- Date: 2026-01-23
-- Author: Claude Code
-- ============================================================
-- Add retail pricing columns to pricing table
-- ============================================================
ALTER TABLE pricing ADD COLUMN hourly_price_retail REAL;
ALTER TABLE pricing ADD COLUMN monthly_price_retail REAL;
-- Backfill existing data with retail prices (wholesale × 1.21)
UPDATE pricing
SET
hourly_price_retail = ROUND(hourly_price * 1.21 * 10000) / 10000,
monthly_price_retail = ROUND(monthly_price * 1.21 * 100) / 100
WHERE hourly_price_retail IS NULL;
-- ============================================================
-- Add retail pricing columns to gpu_pricing table
-- ============================================================
ALTER TABLE gpu_pricing ADD COLUMN hourly_price_retail REAL;
ALTER TABLE gpu_pricing ADD COLUMN monthly_price_retail REAL;
-- Backfill existing data with retail prices (wholesale × 1.21)
UPDATE gpu_pricing
SET
hourly_price_retail = ROUND(hourly_price * 1.21 * 10000) / 10000,
monthly_price_retail = ROUND(monthly_price * 1.21 * 100) / 100
WHERE hourly_price_retail IS NULL;
-- ============================================================
-- Add retail pricing columns to g8_pricing table
-- ============================================================
ALTER TABLE g8_pricing ADD COLUMN hourly_price_retail REAL;
ALTER TABLE g8_pricing ADD COLUMN monthly_price_retail REAL;
-- Backfill existing data with retail prices (wholesale × 1.21)
UPDATE g8_pricing
SET
hourly_price_retail = ROUND(hourly_price * 1.21 * 10000) / 10000,
monthly_price_retail = ROUND(monthly_price * 1.21 * 100) / 100
WHERE hourly_price_retail IS NULL;
-- ============================================================
-- Add retail pricing columns to vpu_pricing table
-- ============================================================
ALTER TABLE vpu_pricing ADD COLUMN hourly_price_retail REAL;
ALTER TABLE vpu_pricing ADD COLUMN monthly_price_retail REAL;
-- Backfill existing data with retail prices (wholesale × 1.21)
UPDATE vpu_pricing
SET
hourly_price_retail = ROUND(hourly_price * 1.21 * 10000) / 10000,
monthly_price_retail = ROUND(monthly_price * 1.21 * 100) / 100
WHERE hourly_price_retail IS NULL;