diff --git a/build.gradle b/build.gradle index 6c11246..8bbe3b8 100644 --- a/build.gradle +++ b/build.gradle @@ -22,7 +22,7 @@ apply plugin: 'java' apply plugin: 'maven-publish' group = 'de.jottyfan' -version = '2024.03.16' +version = '2024.03.16b' description = """COJooq""" diff --git a/src/main/java/de/jottyfan/camporganizer/db/jooq/tables/VCamp.java b/src/main/java/de/jottyfan/camporganizer/db/jooq/tables/VCamp.java index acb1060..418a7e6 100644 --- a/src/main/java/de/jottyfan/camporganizer/db/jooq/tables/VCamp.java +++ b/src/main/java/de/jottyfan/camporganizer/db/jooq/tables/VCamp.java @@ -143,6 +143,11 @@ public class VCamp extends TableImpl { */ public final TableField USED_BEDS_FEMALE = createField(DSL.name("used_beds_female"), SQLDataType.BIGINT, this, ""); + /** + * The column public.v_camp.start_booking. + */ + public final TableField START_BOOKING = createField(DSL.name("start_booking"), SQLDataType.LOCALDATETIME(6), this, ""); + private VCamp(Name alias, Table aliased) { this(alias, aliased, (Field[]) null, null); } @@ -180,7 +185,8 @@ public class VCamp extends TableImpl { c.blocked_beds_female, c.blocked_beds_male, COALESCE(male.used, (0)::bigint) AS used_beds_male, - COALESCE(female.used, (0)::bigint) AS used_beds_female + COALESCE(female.used, (0)::bigint) AS used_beds_female, + c.start_booking FROM (((t_camp c LEFT JOIN t_location l ON ((c.fk_location = l.pk))) LEFT JOIN male ON ((male.fk_camp = c.pk))) diff --git a/src/main/java/de/jottyfan/camporganizer/db/jooq/tables/pojos/VCamp.java b/src/main/java/de/jottyfan/camporganizer/db/jooq/tables/pojos/VCamp.java index 8f2ce23..cf1dff7 100644 --- a/src/main/java/de/jottyfan/camporganizer/db/jooq/tables/pojos/VCamp.java +++ b/src/main/java/de/jottyfan/camporganizer/db/jooq/tables/pojos/VCamp.java @@ -35,6 +35,7 @@ public class VCamp implements Serializable { private final Integer blockedBedsMale; private final Long usedBedsMale; private final Long usedBedsFemale; + private final LocalDateTime startBooking; public VCamp(VCamp value) { this.pk = value.pk; @@ -56,6 +57,7 @@ public class VCamp implements Serializable { this.blockedBedsMale = value.blockedBedsMale; this.usedBedsMale = value.usedBedsMale; this.usedBedsFemale = value.usedBedsFemale; + this.startBooking = value.startBooking; } public VCamp( @@ -77,7 +79,8 @@ public class VCamp implements Serializable { Integer blockedBedsFemale, Integer blockedBedsMale, Long usedBedsMale, - Long usedBedsFemale + Long usedBedsFemale, + LocalDateTime startBooking ) { this.pk = pk; this.isOver = isOver; @@ -98,6 +101,7 @@ public class VCamp implements Serializable { this.blockedBedsMale = blockedBedsMale; this.usedBedsMale = usedBedsMale; this.usedBedsFemale = usedBedsFemale; + this.startBooking = startBooking; } /** @@ -233,6 +237,13 @@ public class VCamp implements Serializable { return this.usedBedsFemale; } + /** + * Getter for public.v_camp.start_booking. + */ + public LocalDateTime getStartBooking() { + return this.startBooking; + } + @Override public boolean equals(Object obj) { if (this == obj) @@ -356,6 +367,12 @@ public class VCamp implements Serializable { } else if (!this.usedBedsFemale.equals(other.usedBedsFemale)) return false; + if (this.startBooking == null) { + if (other.startBooking != null) + return false; + } + else if (!this.startBooking.equals(other.startBooking)) + return false; return true; } @@ -382,6 +399,7 @@ public class VCamp implements Serializable { result = prime * result + ((this.blockedBedsMale == null) ? 0 : this.blockedBedsMale.hashCode()); result = prime * result + ((this.usedBedsMale == null) ? 0 : this.usedBedsMale.hashCode()); result = prime * result + ((this.usedBedsFemale == null) ? 0 : this.usedBedsFemale.hashCode()); + result = prime * result + ((this.startBooking == null) ? 0 : this.startBooking.hashCode()); return result; } @@ -408,6 +426,7 @@ public class VCamp implements Serializable { sb.append(", ").append(blockedBedsMale); sb.append(", ").append(usedBedsMale); sb.append(", ").append(usedBedsFemale); + sb.append(", ").append(startBooking); sb.append(")"); return sb.toString(); diff --git a/src/main/java/de/jottyfan/camporganizer/db/jooq/tables/records/VCampRecord.java b/src/main/java/de/jottyfan/camporganizer/db/jooq/tables/records/VCampRecord.java index ae7f6e3..d50cac7 100644 --- a/src/main/java/de/jottyfan/camporganizer/db/jooq/tables/records/VCampRecord.java +++ b/src/main/java/de/jottyfan/camporganizer/db/jooq/tables/records/VCampRecord.java @@ -304,6 +304,21 @@ public class VCampRecord extends TableRecordImpl { return (Long) get(18); } + /** + * Setter for public.v_camp.start_booking. + */ + public VCampRecord setStartBooking(LocalDateTime value) { + set(19, value); + return this; + } + + /** + * Getter for public.v_camp.start_booking. + */ + public LocalDateTime getStartBooking() { + return (LocalDateTime) get(19); + } + // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- @@ -318,7 +333,7 @@ public class VCampRecord extends TableRecordImpl { /** * Create a detached, initialised VCampRecord */ - public VCampRecord(Integer pk, Boolean isOver, String name, LocalDateTime arrive, LocalDateTime depart, Double year, String locationName, Integer minAge, Integer maxAge, String url, String price, String countries, Integer fkDocument, Integer bedsFemale, Integer bedsMale, Integer blockedBedsFemale, Integer blockedBedsMale, Long usedBedsMale, Long usedBedsFemale) { + public VCampRecord(Integer pk, Boolean isOver, String name, LocalDateTime arrive, LocalDateTime depart, Double year, String locationName, Integer minAge, Integer maxAge, String url, String price, String countries, Integer fkDocument, Integer bedsFemale, Integer bedsMale, Integer blockedBedsFemale, Integer blockedBedsMale, Long usedBedsMale, Long usedBedsFemale, LocalDateTime startBooking) { super(VCamp.V_CAMP); setPk(pk); @@ -340,6 +355,7 @@ public class VCampRecord extends TableRecordImpl { setBlockedBedsMale(blockedBedsMale); setUsedBedsMale(usedBedsMale); setUsedBedsFemale(usedBedsFemale); + setStartBooking(startBooking); resetChangedOnNotNull(); } @@ -369,6 +385,7 @@ public class VCampRecord extends TableRecordImpl { setBlockedBedsMale(value.getBlockedBedsMale()); setUsedBedsMale(value.getUsedBedsMale()); setUsedBedsFemale(value.getUsedBedsFemale()); + setStartBooking(value.getStartBooking()); resetChangedOnNotNull(); } } diff --git a/src/main/resources/upgrade_2024-03-16.sql b/src/main/resources/upgrade_2024-03-16.sql index 77add9f..0056e24 100644 --- a/src/main/resources/upgrade_2024-03-16.sql +++ b/src/main/resources/upgrade_2024-03-16.sql @@ -4,6 +4,7 @@ begin; update t_camp set start_booking = '2000-01-01'; alter table t_camp alter column start_booking set not null; + \i views/camp.sql \i views/version.sql commit; diff --git a/src/main/resources/views/camp.sql b/src/main/resources/views/camp.sql index 93d1692..7f28987 100644 --- a/src/main/resources/views/camp.sql +++ b/src/main/resources/views/camp.sql @@ -31,7 +31,8 @@ with female(used, fk_camp) as ( c.blocked_beds_female, c.blocked_beds_male, coalesce(male.used, 0) as used_beds_male, - coalesce(female.used, 0) as used_beds_female + coalesce(female.used, 0) as used_beds_female, + c.start_booking from public.t_camp c left join public.t_location l on c.fk_location = l.pk left join male on male.fk_camp = c.pk