añadido seeder para series de facturacion

This commit is contained in:
2026-01-04 13:11:47 +01:00
parent 400251ac3d
commit 4a535ab644
11 changed files with 799 additions and 13 deletions

View File

@ -0,0 +1,67 @@
databaseChangeLog:
- changeSet:
id: 0024-series-facturacion-seeder
author: jjo
context: demo
changes:
# --- SERIES ---
- sql:
splitStatements: true
stripComments: true
sql: |
INSERT INTO series_facturas
(nombre_serie, prefijo, tipo, numero_actual, created_at, updated_at, created_by, updated_by)
SELECT
'IMPRESIÓN DIGITAL', 'IMPR', 'facturacion', 1, NOW(), NOW(), 1, 1
WHERE NOT EXISTS (
SELECT 1 FROM series_facturas WHERE prefijo = 'IMPR'
);
INSERT INTO series_facturas
(nombre_serie, prefijo, tipo, numero_actual, created_at, updated_at, created_by, updated_by)
SELECT
'RECT. IMPRESIÓN DIGITAL', 'REC IL', 'facturacion', 1, NOW(), NOW(), 1, 1
WHERE NOT EXISTS (
SELECT 1 FROM series_facturas WHERE prefijo = 'REC IL'
);
# --- VARIABLES (con el id real de la serie) ---
# serie_facturacion_default -> id de la serie con prefijo IMPR
- sql:
splitStatements: true
stripComments: true
sql: |
INSERT INTO variables (clave, valor)
SELECT
'serie_facturacion_default',
CAST(sf.id AS CHAR)
FROM series_facturas sf
WHERE sf.prefijo = 'IMPR'
LIMIT 1
ON DUPLICATE KEY UPDATE valor = VALUES(valor);
# sere_facturacion_rect_default -> id de la serie con prefijo REC IL
- sql:
splitStatements: true
stripComments: true
sql: |
INSERT INTO variables (clave, valor)
SELECT
'sere_facturacion_rect_default',
CAST(sf.id AS CHAR)
FROM series_facturas sf
WHERE sf.prefijo = 'REC IL'
LIMIT 1
ON DUPLICATE KEY UPDATE valor = VALUES(valor);
rollback:
- sql:
splitStatements: true
stripComments: true
sql: |
DELETE FROM variables
WHERE clave IN ('serie_facturacion_default', 'sere_facturacion_rect_default');
DELETE FROM series_facturas
WHERE prefijo IN ('IMPR', 'REC IL');