salix/db/versions/10862-navyHydrangea/00-alterGastosResumen.sql

12 lines
417 B
MySQL
Raw Permalink Normal View History

2024-02-15 13:21:49 +00:00
USE vn;
2024-02-14 08:02:39 +00:00
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
2024-02-15 13:21:49 +00:00
WHERE e.id IS NULL;
2024-02-14 08:02:39 +00:00
ALTER TABLE vn2008.gastos_resumen
2024-02-15 13:21:49 +00:00
ADD CONSTRAINT gastos_resumen_expense_FK
FOREIGN KEY (Id_Gasto) REFERENCES vn.expense(id) ON DELETE CASCADE ON UPDATE CASCADE;