Files
cloud-server/migrations/003_add_retail_pricing.sql
kappa 9f3d3a245a 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>
2026-01-25 21:16:25 +09:00

61 lines
2.3 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 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;