added start_booking in t_camp, see #14
This commit is contained in:
parent
a8082842c6
commit
5890777686
@ -22,7 +22,7 @@ apply plugin: 'java'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
group = 'de.jottyfan'
|
||||
version = '2024.03.07'
|
||||
version = '2024.03.16'
|
||||
|
||||
description = """COJooq"""
|
||||
|
||||
@ -47,7 +47,7 @@ dependencies {
|
||||
import org.jooq.meta.jaxb.Logging
|
||||
|
||||
jooq {
|
||||
version = '3.19.1'
|
||||
version = '3.19.6'
|
||||
edition = nu.studer.gradle.jooq.JooqEdition.OSS
|
||||
configurations {
|
||||
camporganizer {
|
||||
|
@ -144,6 +144,11 @@ public class TCamp extends TableImpl<TCampRecord> {
|
||||
*/
|
||||
public final TableField<TCampRecord, Integer> BLOCKED_BEDS_MALE = createField(DSL.name("blocked_beds_male"), SQLDataType.INTEGER.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.INTEGER)), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>public.t_camp.start_booking</code>.
|
||||
*/
|
||||
public final TableField<TCampRecord, LocalDateTime> START_BOOKING = createField(DSL.name("start_booking"), SQLDataType.LOCALDATETIME(6).nullable(false), this, "");
|
||||
|
||||
private TCamp(Name alias, Table<TCampRecord> aliased) {
|
||||
this(alias, aliased, (Field<?>[]) null, null);
|
||||
}
|
||||
@ -181,6 +186,8 @@ public class TCamp extends TableImpl<TCampRecord> {
|
||||
* A subtype implementing {@link Path} for simplified path-based joins.
|
||||
*/
|
||||
public static class TCampPath extends TCamp implements Path<TCampRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public <O extends Record> TCampPath(Table<O> path, ForeignKey<O, TCampRecord> childPath, InverseForeignKey<O, TCampRecord> parentPath) {
|
||||
super(path, childPath, parentPath);
|
||||
}
|
||||
|
@ -110,6 +110,8 @@ public class TCampdocument extends TableImpl<TCampdocumentRecord> {
|
||||
* A subtype implementing {@link Path} for simplified path-based joins.
|
||||
*/
|
||||
public static class TCampdocumentPath extends TCampdocument implements Path<TCampdocumentRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public <O extends Record> TCampdocumentPath(Table<O> path, ForeignKey<O, TCampdocumentRecord> childPath, InverseForeignKey<O, TCampdocumentRecord> parentPath) {
|
||||
super(path, childPath, parentPath);
|
||||
}
|
||||
|
@ -116,6 +116,8 @@ public class TCampprofile extends TableImpl<TCampprofileRecord> {
|
||||
* A subtype implementing {@link Path} for simplified path-based joins.
|
||||
*/
|
||||
public static class TCampprofilePath extends TCampprofile implements Path<TCampprofileRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public <O extends Record> TCampprofilePath(Table<O> path, ForeignKey<O, TCampprofileRecord> childPath, InverseForeignKey<O, TCampprofileRecord> parentPath) {
|
||||
super(path, childPath, parentPath);
|
||||
}
|
||||
|
@ -124,6 +124,8 @@ public class TDocument extends TableImpl<TDocumentRecord> {
|
||||
* A subtype implementing {@link Path} for simplified path-based joins.
|
||||
*/
|
||||
public static class TDocumentPath extends TDocument implements Path<TDocumentRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public <O extends Record> TDocumentPath(Table<O> path, ForeignKey<O, TDocumentRecord> childPath, InverseForeignKey<O, TDocumentRecord> parentPath) {
|
||||
super(path, childPath, parentPath);
|
||||
}
|
||||
|
@ -110,6 +110,8 @@ public class TDocumentrole extends TableImpl<TDocumentroleRecord> {
|
||||
* A subtype implementing {@link Path} for simplified path-based joins.
|
||||
*/
|
||||
public static class TDocumentrolePath extends TDocumentrole implements Path<TDocumentroleRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public <O extends Record> TDocumentrolePath(Table<O> path, ForeignKey<O, TDocumentroleRecord> childPath, InverseForeignKey<O, TDocumentroleRecord> parentPath) {
|
||||
super(path, childPath, parentPath);
|
||||
}
|
||||
|
@ -115,6 +115,8 @@ public class TLocation extends TableImpl<TLocationRecord> {
|
||||
* A subtype implementing {@link Path} for simplified path-based joins.
|
||||
*/
|
||||
public static class TLocationPath extends TLocation implements Path<TLocationRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public <O extends Record> TLocationPath(Table<O> path, ForeignKey<O, TLocationRecord> childPath, InverseForeignKey<O, TLocationRecord> parentPath) {
|
||||
super(path, childPath, parentPath);
|
||||
}
|
||||
|
@ -201,6 +201,8 @@ public class TPerson extends TableImpl<TPersonRecord> {
|
||||
* A subtype implementing {@link Path} for simplified path-based joins.
|
||||
*/
|
||||
public static class TPersonPath extends TPerson implements Path<TPersonRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public <O extends Record> TPersonPath(Table<O> path, ForeignKey<O, TPersonRecord> childPath, InverseForeignKey<O, TPersonRecord> parentPath) {
|
||||
super(path, childPath, parentPath);
|
||||
}
|
||||
|
@ -120,6 +120,8 @@ public class TPersondocument extends TableImpl<TPersondocumentRecord> {
|
||||
* A subtype implementing {@link Path} for simplified path-based joins.
|
||||
*/
|
||||
public static class TPersondocumentPath extends TPersondocument implements Path<TPersondocumentRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public <O extends Record> TPersondocumentPath(Table<O> path, ForeignKey<O, TPersondocumentRecord> childPath, InverseForeignKey<O, TPersondocumentRecord> parentPath) {
|
||||
super(path, childPath, parentPath);
|
||||
}
|
||||
|
@ -133,6 +133,8 @@ public class TProfile extends TableImpl<TProfileRecord> {
|
||||
* A subtype implementing {@link Path} for simplified path-based joins.
|
||||
*/
|
||||
public static class TProfilePath extends TProfile implements Path<TProfileRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public <O extends Record> TProfilePath(Table<O> path, ForeignKey<O, TProfileRecord> childPath, InverseForeignKey<O, TProfileRecord> parentPath) {
|
||||
super(path, childPath, parentPath);
|
||||
}
|
||||
|
@ -104,6 +104,8 @@ public class TProfilerole extends TableImpl<TProfileroleRecord> {
|
||||
* A subtype implementing {@link Path} for simplified path-based joins.
|
||||
*/
|
||||
public static class TProfilerolePath extends TProfilerole implements Path<TProfileroleRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public <O extends Record> TProfilerolePath(Table<O> path, ForeignKey<O, TProfileroleRecord> childPath, InverseForeignKey<O, TProfileroleRecord> parentPath) {
|
||||
super(path, childPath, parentPath);
|
||||
}
|
||||
|
@ -153,6 +153,8 @@ public class TSales extends TableImpl<TSalesRecord> {
|
||||
* A subtype implementing {@link Path} for simplified path-based joins.
|
||||
*/
|
||||
public static class TSalesPath extends TSales implements Path<TSalesRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public <O extends Record> TSalesPath(Table<O> path, ForeignKey<O, TSalesRecord> childPath, InverseForeignKey<O, TSalesRecord> parentPath) {
|
||||
super(path, childPath, parentPath);
|
||||
}
|
||||
|
@ -104,6 +104,8 @@ public class TSalescontent extends TableImpl<TSalescontentRecord> {
|
||||
* A subtype implementing {@link Path} for simplified path-based joins.
|
||||
*/
|
||||
public static class TSalescontentPath extends TSalescontent implements Path<TSalescontentRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public <O extends Record> TSalescontentPath(Table<O> path, ForeignKey<O, TSalescontentRecord> childPath, InverseForeignKey<O, TSalescontentRecord> parentPath) {
|
||||
super(path, childPath, parentPath);
|
||||
}
|
||||
|
@ -97,6 +97,8 @@ public class TSalescontenttype extends TableImpl<TSalescontenttypeRecord> {
|
||||
* A subtype implementing {@link Path} for simplified path-based joins.
|
||||
*/
|
||||
public static class TSalescontenttypePath extends TSalescontenttype implements Path<TSalescontenttypeRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public <O extends Record> TSalescontenttypePath(Table<O> path, ForeignKey<O, TSalescontenttypeRecord> childPath, InverseForeignKey<O, TSalescontenttypeRecord> parentPath) {
|
||||
super(path, childPath, parentPath);
|
||||
}
|
||||
|
@ -149,7 +149,20 @@ public class VCamp extends TableImpl<VCampRecord> {
|
||||
|
||||
private VCamp(Name alias, Table<VCampRecord> aliased, Field<?>[] parameters, Condition where) {
|
||||
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
|
||||
create view "v_camp" as SELECT c.pk,
|
||||
create view "v_camp" as WITH female(used, fk_camp) AS (
|
||||
SELECT count(1) AS count,
|
||||
t_person.fk_camp
|
||||
FROM t_person
|
||||
WHERE ((t_person.accept = true) AND (t_person.sex = 'female'::enum_sex) AND (t_person.camprole = 'student'::enum_camprole))
|
||||
GROUP BY t_person.fk_camp
|
||||
), male(used, fk_camp) AS (
|
||||
SELECT count(1) AS count,
|
||||
t_person.fk_camp
|
||||
FROM t_person
|
||||
WHERE ((t_person.accept = true) AND (t_person.sex = 'male'::enum_sex) AND (t_person.camprole = 'student'::enum_camprole))
|
||||
GROUP BY t_person.fk_camp
|
||||
)
|
||||
SELECT c.pk,
|
||||
(c.depart < now()) AS is_over,
|
||||
c.name,
|
||||
c.arrive,
|
||||
@ -166,13 +179,12 @@ public class VCamp extends TableImpl<VCampRecord> {
|
||||
c.beds_male,
|
||||
c.blocked_beds_female,
|
||||
c.blocked_beds_male,
|
||||
count(mp.pk) AS used_beds_male,
|
||||
count(fp.pk) AS used_beds_female
|
||||
COALESCE(male.used, (0)::bigint) AS used_beds_male,
|
||||
COALESCE(female.used, (0)::bigint) AS used_beds_female
|
||||
FROM (((t_camp c
|
||||
LEFT JOIN t_location l ON ((c.fk_location = l.pk)))
|
||||
LEFT JOIN 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))))
|
||||
LEFT JOIN 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))))
|
||||
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;
|
||||
LEFT JOIN male ON ((male.fk_camp = c.pk)))
|
||||
LEFT JOIN female ON ((female.fk_camp = c.pk)));
|
||||
"""), where);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class VVersion extends TableImpl<VVersionRecord> {
|
||||
|
||||
private VVersion(Name alias, Table<VVersionRecord> aliased, Field<?>[] parameters, Condition where) {
|
||||
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view("""
|
||||
create view "v_version" as SELECT '2024.02'::text AS version;
|
||||
create view "v_version" as SELECT '2024.03.16'::text AS version;
|
||||
"""), where);
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@ public class TCamp implements Serializable {
|
||||
private final Integer bedsFemale;
|
||||
private final Integer blockedBedsFemale;
|
||||
private final Integer blockedBedsMale;
|
||||
private final LocalDateTime startBooking;
|
||||
|
||||
public TCamp(TCamp value) {
|
||||
this.pk = value.pk;
|
||||
@ -50,6 +51,7 @@ public class TCamp implements Serializable {
|
||||
this.bedsFemale = value.bedsFemale;
|
||||
this.blockedBedsFemale = value.blockedBedsFemale;
|
||||
this.blockedBedsMale = value.blockedBedsMale;
|
||||
this.startBooking = value.startBooking;
|
||||
}
|
||||
|
||||
public TCamp(
|
||||
@ -68,7 +70,8 @@ public class TCamp implements Serializable {
|
||||
Integer bedsMale,
|
||||
Integer bedsFemale,
|
||||
Integer blockedBedsFemale,
|
||||
Integer blockedBedsMale
|
||||
Integer blockedBedsMale,
|
||||
LocalDateTime startBooking
|
||||
) {
|
||||
this.pk = pk;
|
||||
this.name = name;
|
||||
@ -86,6 +89,7 @@ public class TCamp implements Serializable {
|
||||
this.bedsFemale = bedsFemale;
|
||||
this.blockedBedsFemale = blockedBedsFemale;
|
||||
this.blockedBedsMale = blockedBedsMale;
|
||||
this.startBooking = startBooking;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -200,6 +204,13 @@ public class TCamp implements Serializable {
|
||||
return this.blockedBedsMale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>public.t_camp.start_booking</code>.
|
||||
*/
|
||||
public LocalDateTime getStartBooking() {
|
||||
return this.startBooking;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
@ -305,6 +316,12 @@ public class TCamp implements Serializable {
|
||||
}
|
||||
else if (!this.blockedBedsMale.equals(other.blockedBedsMale))
|
||||
return false;
|
||||
if (this.startBooking == null) {
|
||||
if (other.startBooking != null)
|
||||
return false;
|
||||
}
|
||||
else if (!this.startBooking.equals(other.startBooking))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -328,6 +345,7 @@ public class TCamp implements Serializable {
|
||||
result = prime * result + ((this.bedsFemale == null) ? 0 : this.bedsFemale.hashCode());
|
||||
result = prime * result + ((this.blockedBedsFemale == null) ? 0 : this.blockedBedsFemale.hashCode());
|
||||
result = prime * result + ((this.blockedBedsMale == null) ? 0 : this.blockedBedsMale.hashCode());
|
||||
result = prime * result + ((this.startBooking == null) ? 0 : this.startBooking.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -351,6 +369,7 @@ public class TCamp implements Serializable {
|
||||
sb.append(", ").append(bedsFemale);
|
||||
sb.append(", ").append(blockedBedsFemale);
|
||||
sb.append(", ").append(blockedBedsMale);
|
||||
sb.append(", ").append(startBooking);
|
||||
|
||||
sb.append(")");
|
||||
return sb.toString();
|
||||
|
@ -260,6 +260,21 @@ public class TCampRecord extends UpdatableRecordImpl<TCampRecord> {
|
||||
return (Integer) get(15);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>public.t_camp.start_booking</code>.
|
||||
*/
|
||||
public TCampRecord setStartBooking(LocalDateTime value) {
|
||||
set(16, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>public.t_camp.start_booking</code>.
|
||||
*/
|
||||
public LocalDateTime getStartBooking() {
|
||||
return (LocalDateTime) get(16);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Primary key information
|
||||
// -------------------------------------------------------------------------
|
||||
@ -283,7 +298,7 @@ public class TCampRecord extends UpdatableRecordImpl<TCampRecord> {
|
||||
/**
|
||||
* Create a detached, initialised TCampRecord
|
||||
*/
|
||||
public TCampRecord(Integer pk, String name, LocalDateTime arrive, LocalDateTime depart, Integer fkLocation, Integer minAge, Integer maxAge, String price, String countries, Integer fkDocument, Boolean lockSales, Integer fkProfile, Integer bedsMale, Integer bedsFemale, Integer blockedBedsFemale, Integer blockedBedsMale) {
|
||||
public TCampRecord(Integer pk, String name, LocalDateTime arrive, LocalDateTime depart, Integer fkLocation, Integer minAge, Integer maxAge, String price, String countries, Integer fkDocument, Boolean lockSales, Integer fkProfile, Integer bedsMale, Integer bedsFemale, Integer blockedBedsFemale, Integer blockedBedsMale, LocalDateTime startBooking) {
|
||||
super(TCamp.T_CAMP);
|
||||
|
||||
setPk(pk);
|
||||
@ -302,6 +317,7 @@ public class TCampRecord extends UpdatableRecordImpl<TCampRecord> {
|
||||
setBedsFemale(bedsFemale);
|
||||
setBlockedBedsFemale(blockedBedsFemale);
|
||||
setBlockedBedsMale(blockedBedsMale);
|
||||
setStartBooking(startBooking);
|
||||
resetChangedOnNotNull();
|
||||
}
|
||||
|
||||
@ -328,6 +344,7 @@ public class TCampRecord extends UpdatableRecordImpl<TCampRecord> {
|
||||
setBedsFemale(value.getBedsFemale());
|
||||
setBlockedBedsFemale(value.getBlockedBedsFemale());
|
||||
setBlockedBedsMale(value.getBlockedBedsMale());
|
||||
setStartBooking(value.getStartBooking());
|
||||
resetChangedOnNotNull();
|
||||
}
|
||||
}
|
||||
|
@ -14,5 +14,6 @@ create table public.t_camp (
|
||||
beds_male integer not null default 0,
|
||||
beds_female integer not null default 0,
|
||||
blocked_beds_male integer not null default 0,
|
||||
blocked_beds_female integer not null default 0
|
||||
blocked_beds_female integer not null default 0,
|
||||
start_booking timestamp without time zone not null
|
||||
);
|
||||
|
@ -1,6 +0,0 @@
|
||||
begin;
|
||||
|
||||
\i views/camp.sql
|
||||
\i views/version.sql
|
||||
|
||||
commit;
|
9
src/main/resources/upgrade_2024-03-16.sql
Normal file
9
src/main/resources/upgrade_2024-03-16.sql
Normal file
@ -0,0 +1,9 @@
|
||||
begin;
|
||||
|
||||
alter table t_camp add column start_booking timestamp without time zone;
|
||||
update t_camp set start_booking = '2000-01-01';
|
||||
alter table t_camp alter column start_booking set not null;
|
||||
|
||||
\i views/version.sql
|
||||
|
||||
commit;
|
@ -1,2 +1,2 @@
|
||||
create or replace view public.v_version as
|
||||
select '2024.03.07'::text as version;
|
||||
select '2024.03.16'::text as version;
|
||||
|
Loading…
x
Reference in New Issue
Block a user