From e7a6610aa0d30be8dd6387c84c489abc836a008b Mon Sep 17 00:00:00 2001 From: Juanjo <110014245+juanjo-alvarez@users.noreply.github.com> Date: Wed, 15 Jan 2025 15:06:26 +0100 Subject: [PATCH] tutors type left join --- .../src/main/resources/db/migration/V46__repare_tutors_type.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cd2024bfs4g1-model/src/main/resources/db/migration/V46__repare_tutors_type.sql b/cd2024bfs4g1-model/src/main/resources/db/migration/V46__repare_tutors_type.sql index e44e0bcc5..3edc7d2b6 100644 --- a/cd2024bfs4g1-model/src/main/resources/db/migration/V46__repare_tutors_type.sql +++ b/cd2024bfs4g1-model/src/main/resources/db/migration/V46__repare_tutors_type.sql @@ -4,5 +4,7 @@ DELETE FROM public.tutors_type WHERE id IN (1,2); INSERT INTO public.tutors_type (id, "type") VALUES(1, 'Titular'); INSERT INTO public.tutors_type (id, "type") VALUES(2, 'Apoyo'); +UPDATE tutor_bootcamp tb SET tutor_type=2 WHERE NOT EXISTS (SELECT 1 FROM tutors_type tt WHERE tb.tutor_type=tt.id); + ALTER TABLE tutor_bootcamp ADD CONSTRAINT fk_tutor_type_bootcamp FOREIGN KEY (tutor_type) REFERENCES tutors_type(id); \ No newline at end of file