mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-24 09:40:21 +00:00
añadido seeder para series de facturacion
This commit is contained in:
@ -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');
|
||||
@ -44,4 +44,6 @@ databaseChangeLog:
|
||||
- include:
|
||||
file: db/changelog/changesets/0022-add-estados-pago-to-pedidos-lineas-3.yml
|
||||
- include:
|
||||
file: db/changelog/changesets/0023-facturacion.yml
|
||||
file: db/changelog/changesets/0023-facturacion.yml
|
||||
- include:
|
||||
file: db/changelog/changesets/0024-series-facturacion-seeder.yml
|
||||
Reference in New Issue
Block a user