feat(db): Medio + Seccion (temporal tables + seed) — ADM-001 B1
V011 crea dbo.Medio y dbo.Seccion con SYSTEM_VERSIONING ON (retention 10 anios) y PAGE compression en history; siembra el permiso 'administracion:secciones:gestionar' y lo asigna a rol admin. El permiso 'administracion:medios:gestionar' ya existia desde V005. V012 siembra Medios fundacionales ELDIA y ELPLATA (MERGE idempotente). Rollbacks V011/V012 validados estructuralmente; aplicacion y reaplicacion verificadas en SIGCM2_Test y SIGCM2. Fixture de tests actualizado: EnsureV011SchemaAsync, SeedMediosCanonicalAsync, ignora Medio_History y Seccion_History en Respawner.
This commit is contained in:
27
database/migrations/V012__seed_medios.sql
Normal file
27
database/migrations/V012__seed_medios.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- V012__seed_medios.sql
|
||||
-- ADM-001: seed inicial de Medios ELDIA y ELPLATA.
|
||||
--
|
||||
-- Idempotente via MERGE por Codigo.
|
||||
-- Tipo = 1 (Diario) per enum TipoMedio.
|
||||
-- PlataformaEmpresaId = NULL (INT-003 lo poblará cuando exista el mapeo IMAC).
|
||||
--
|
||||
-- Run on: SIGCM2 (dev) y SIGCM2_Test (integration tests).
|
||||
|
||||
SET QUOTED_IDENTIFIER ON;
|
||||
SET ANSI_NULLS ON;
|
||||
SET NOCOUNT ON;
|
||||
GO
|
||||
|
||||
MERGE dbo.Medio AS t
|
||||
USING (VALUES
|
||||
('ELDIA', N'El Día', 1),
|
||||
('ELPLATA', N'El Plata', 1)
|
||||
) AS s (Codigo, Nombre, Tipo)
|
||||
ON t.Codigo = s.Codigo
|
||||
WHEN NOT MATCHED BY TARGET THEN
|
||||
INSERT (Codigo, Nombre, Tipo, PlataformaEmpresaId, Activo)
|
||||
VALUES (s.Codigo, s.Nombre, s.Tipo, NULL, 1);
|
||||
GO
|
||||
|
||||
PRINT 'V012 applied — Medios ELDIA y ELPLATA seeded (idempotent).';
|
||||
GO
|
||||
Reference in New Issue
Block a user