-- V022__seed_chargeable_char_config.sql -- PRC-001: seed de las 4 configuraciones globales de caracteres tasables por defecto. -- -- Cambios: -- 1. Inserta 4 filas globales (MedioId NULL): $, %, !, ¡ — precios placeholder 1.0000. -- El equipo de negocio seteará los valores reales desde el CMS. -- -- Patrón: MERGE idempotente ON (MedioId IS NULL AND Symbol AND ValidTo IS NULL). -- Idempotente: seguro para re-ejecutar. -- Reversa: V022_ROLLBACK.sql. -- Run on: SIGCM2 (dev), SIGCM2_Test_App, SIGCM2_Test_Api. -- -- Depends on: V021 (dbo.ChargeableCharConfig must exist). -- -- Notas: -- - MedioId NULL = global fallback; aplica a todos los medios a menos que exista -- una fila per-medio más específica (resolución en usp_ChargeableCharConfig_GetActiveForMedio). -- - ValidFrom = 2026-01-01: retroactivo al inicio del año fiscal 2026. -- - ValidTo NULL = vigente (sin fecha de cierre). -- - PricePerUnit 1.0000 son placeholders — CONFIRMAR con el área de tasación. -- -- SDD Design: engram sdd/prc-001-word-counter-spike/design (§3.3) SET QUOTED_IDENTIFIER ON; SET ANSI_NULLS ON; SET NOCOUNT ON; GO MERGE dbo.ChargeableCharConfig AS t USING (VALUES (NULL, N'$', N'Currency', CAST(1.0000 AS DECIMAL(18,4)), CAST('2026-01-01' AS DATE)), (NULL, N'%', N'Percentage', CAST(1.0000 AS DECIMAL(18,4)), CAST('2026-01-01' AS DATE)), (NULL, N'!', N'Exclamation', CAST(1.0000 AS DECIMAL(18,4)), CAST('2026-01-01' AS DATE)), (NULL, N'¡', N'Exclamation', CAST(1.0000 AS DECIMAL(18,4)), CAST('2026-01-01' AS DATE)) ) AS s (MedioId, Symbol, Category, PricePerUnit, ValidFrom) ON (t.MedioId IS NULL AND s.MedioId IS NULL AND t.Symbol = s.Symbol AND t.ValidTo IS NULL) WHEN NOT MATCHED THEN INSERT (MedioId, Symbol, Category, PricePerUnit, ValidFrom, ValidTo, IsActive) VALUES (s.MedioId, s.Symbol, s.Category, s.PricePerUnit, s.ValidFrom, NULL, 1); GO PRINT 'V022 applied — 4 global ChargeableCharConfig defaults seeded ($, %, !, ¡).'; PRINT 'NOTE: PricePerUnit values are placeholders (1.0000). Update via CMS before going live.'; GO