- 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>
61 lines
2.3 KiB
SQL
61 lines
2.3 KiB
SQL
-- 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;
|