feat: #6392 fk que faltan
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Javi Gallego 2024-02-15 14:21:49 +01:00
parent 6691155217
commit 27627017c5
10 changed files with 27 additions and 44 deletions

View File

@ -0,0 +1,3 @@
USE vn;
ALTER TABLE vn.agencyTermConfig
ADD CONSTRAINT agencyTermConfig_expense_FK FOREIGN KEY (expenseFk) REFERENCES vn.expense(id) ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -1,8 +1,11 @@
USE vn;
ALTER TABLE vn2008.gastos_resumen MODIFY COLUMN Id_Gasto varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL;
DELETE gr.*
FROM vn2008.gastos_resumen gr LEFT JOIN vn.expense e ON gr.Id_Gasto = e.id
WHERE e.id IS NULL AND importe;
WHERE e.id IS NULL;
ALTER TABLE vn2008.gastos_resumen
ADD CONSTRAINT gastos_resumen_expense_FKFOREIGN KEY (Id_Gasto) REFERENCES vn.expense(id) ON DELETE CASCADE ON UPDATE CASCADE;
ADD CONSTRAINT gastos_resumen_expense_FK
FOREIGN KEY (Id_Gasto) REFERENCES vn.expense(id) ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -0,0 +1,5 @@
USE vn;
ALTER TABLE vn.invoiceOutTaxConfig MODIFY COLUMN expenseFk varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL NULL;
ALTER TABLE vn.invoiceOutTaxConfig
ADD CONSTRAINT invoiceOutTaxConfig_expense_FK FOREIGN KEY (expenseFk) REFERENCES vn.expense(id) ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -0,0 +1,5 @@
USE edi;
ALTER TABLE edi.item_groupToOffer MODIFY COLUMN expenseFk varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '7001000000' NULL;
ALTER TABLE edi.item_groupToOffer
ADD CONSTRAINT item_groupToOffer_expense_FK FOREIGN KEY (expenseFk) REFERENCES vn.expense(id) ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -1,5 +1,14 @@
USE vn;
-- Eliminar la clave primaria actual
ALTER TABLE bs.ventas_contables DROP PRIMARY KEY;
-- Agregar la nueva clave primaria incluyendo el campo `gasto`
ALTER TABLE bs.ventas_contables ADD PRIMARY KEY (`year`, `month`, `grupo`, `reino_id`, `tipo_id`, `empresa_id`, `gasto`);
DELETE vc.* FROM bs.ventas_contables vc LEFT JOIN vn.expense e ON e.id = vc.gasto WHERE e.id IS NULL;
ALTER TABLE bs.ventas_contables
MODIFY COLUMN gasto VARCHAR(10)
CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL;
ALTER TABLE bs.ventas_contables ADD CONSTRAINT ventas_contables_expense_FK FOREIGN KEY (gasto) REFERENCES vn.expense(id) ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -6,6 +6,3 @@ UPDATE vn.expense
UPDATE vn.expense
SET id='7001090000'
WHERE id='7001009000';
UPDATE vn.balanceNestTree
SET expenseFk='7001090000'
WHERE expenseFk='7001009000';

View File

@ -1,2 +0,0 @@
-- Actualizar los item.expenseFk de produccion propia
-- Tot lo de producció propia porta el productor o *Polpiser o Santa Dorotea*

View File

@ -1,37 +0,0 @@
CALL bs.ventas_contables_add(2021, 1);
CALL bs.ventas_contables_add(2021, 2);
CALL bs.ventas_contables_add(2021, 3);
CALL bs.ventas_contables_add(2021, 4);
CALL bs.ventas_contables_add(2021, 5);
CALL bs.ventas_contables_add(2021, 6);
CALL bs.ventas_contables_add(2021, 7);
CALL bs.ventas_contables_add(2021, 8);
CALL bs.ventas_contables_add(2021, 9);
CALL bs.ventas_contables_add(2021, 10);
CALL bs.ventas_contables_add(2021, 11);
CALL bs.ventas_contables_add(2021, 12);
CALL bs.ventas_contables_add(2022, 1);
CALL bs.ventas_contables_add(2022, 2);
CALL bs.ventas_contables_add(2022, 3);
CALL bs.ventas_contables_add(2022, 4);
CALL bs.ventas_contables_add(2022, 5);
CALL bs.ventas_contables_add(2022, 6);
CALL bs.ventas_contables_add(2022, 7);
CALL bs.ventas_contables_add(2022, 8);
CALL bs.ventas_contables_add(2022, 9);
CALL bs.ventas_contables_add(2022, 10);
CALL bs.ventas_contables_add(2022, 11);
CALL bs.ventas_contables_add(2022, 12);
CALL bs.ventas_contables_add(2023, 1);
CALL bs.ventas_contables_add(2023, 2);
CALL bs.ventas_contables_add(2023, 3);
CALL bs.ventas_contables_add(2023, 4);
CALL bs.ventas_contables_add(2023, 5);
CALL bs.ventas_contables_add(2023, 6);
CALL bs.ventas_contables_add(2023, 7);
CALL bs.ventas_contables_add(2023, 8);
CALL bs.ventas_contables_add(2023, 9);
CALL bs.ventas_contables_add(2023, 10);
CALL bs.ventas_contables_add(2023, 11);
CALL bs.ventas_contables_add(2023, 12);
CALL bs.ventas_contables_add(2024, 1);