diff --git a/src/main/resources/upgrade_2024-02.sql b/src/main/resources/upgrade_2024-02.sql index 7a71af8..b8f630e 100644 --- a/src/main/resources/upgrade_2024-02.sql +++ b/src/main/resources/upgrade_2024-02.sql @@ -1,3 +1,5 @@ +begin; + alter table camp.t_camp add column beds_male integer not null default 0; alter table camp.t_camp add column beds_female integer not null default 0; alter table camp.t_camp add column blocked_beds_male integer not null default 0; @@ -27,14 +29,19 @@ from camp.t_camp c left join camp.t_location l on c.fk_location = l.pk left join camp.t_person mp on mp.fk_camp = c.pk and mp.accept = true - and mp.sex = 'male'::enum_sex - and mp.camprole = 'student'::enum_camprole + and mp.sex = 'male'::camp.enum_sex + and mp.camprole = 'student'::camp.enum_camprole left join camp.t_person fp on fp.fk_camp = c.pk and fp.accept = true - and fp.sex = 'female'::enum_sex - and fp.camprole = 'student'::enum_camprole + and fp.sex = 'female'::camp.enum_sex + and fp.camprole = 'student'::camp.enum_camprole group by c.pk, c.depart, c.name, c.arrive, l.name, c.min_age, c.max_age, l.url, c.price, c.countries, c.fk_document, c.beds_female, c.beds_male, c.blocked_beds_female, c.blocked_beds_male; -create or replace view public.v_version as +create or replace view camp.v_version as select '2024.02'::text as version; + +drop schema public; +alter schema camp rename to public; + +commit;