diff --git a/build.gradle b/build.gradle index 7e6f430..4d9d16a 100644 --- a/build.gradle +++ b/build.gradle @@ -22,7 +22,7 @@ apply plugin: 'java' apply plugin: 'maven-publish' group = 'de.jottyfan' -version = '1' +version = '2' description = """bicolib""" diff --git a/src/main/java/de/jottyfan/bico/db/Keys.java b/src/main/java/de/jottyfan/bico/db/Keys.java index fc45ee0..a6b898e 100644 --- a/src/main/java/de/jottyfan/bico/db/Keys.java +++ b/src/main/java/de/jottyfan/bico/db/Keys.java @@ -7,12 +7,14 @@ package de.jottyfan.bico.db; import de.jottyfan.bico.db.tables.TLesson; import de.jottyfan.bico.db.tables.TLessonSubject; import de.jottyfan.bico.db.tables.TPerson; +import de.jottyfan.bico.db.tables.TProfile; import de.jottyfan.bico.db.tables.TSlot; import de.jottyfan.bico.db.tables.TSource; import de.jottyfan.bico.db.tables.TSubject; import de.jottyfan.bico.db.tables.records.TLessonRecord; import de.jottyfan.bico.db.tables.records.TLessonSubjectRecord; import de.jottyfan.bico.db.tables.records.TPersonRecord; +import de.jottyfan.bico.db.tables.records.TProfileRecord; import de.jottyfan.bico.db.tables.records.TSlotRecord; import de.jottyfan.bico.db.tables.records.TSourceRecord; import de.jottyfan.bico.db.tables.records.TSubjectRecord; @@ -42,6 +44,8 @@ public class Keys { public static final UniqueKey T_PERSON_ABBREVIATION_KEY = Internal.createUniqueKey(TPerson.T_PERSON, DSL.name("t_person_abbreviation_key"), new TableField[] { TPerson.T_PERSON.ABBREVIATION }, true); public static final UniqueKey T_PERSON_FORENAME_SURNAME_KEY = Internal.createUniqueKey(TPerson.T_PERSON, DSL.name("t_person_forename_surname_key"), new TableField[] { TPerson.T_PERSON.FORENAME, TPerson.T_PERSON.SURNAME }, true); public static final UniqueKey T_PERSON_PKEY = Internal.createUniqueKey(TPerson.T_PERSON, DSL.name("t_person_pkey"), new TableField[] { TPerson.T_PERSON.PK_PERSON }, true); + public static final UniqueKey T_PROFILE_PKEY = Internal.createUniqueKey(TProfile.T_PROFILE, DSL.name("t_profile_pkey"), new TableField[] { TProfile.T_PROFILE.ID }, true); + public static final UniqueKey T_PROFILE_USERNAME_KEY = Internal.createUniqueKey(TProfile.T_PROFILE, DSL.name("t_profile_username_key"), new TableField[] { TProfile.T_PROFILE.USERNAME }, true); public static final UniqueKey T_LESSONDAY_LESSON_DAY_KEY = Internal.createUniqueKey(TSlot.T_SLOT, DSL.name("t_lessonday_lesson_day_key"), new TableField[] { TSlot.T_SLOT.SLOT_DAY }, true); public static final UniqueKey T_LESSONDAY_PKEY = Internal.createUniqueKey(TSlot.T_SLOT, DSL.name("t_lessonday_pkey"), new TableField[] { TSlot.T_SLOT.PK_SLOT }, true); public static final UniqueKey T_SOURCE_NAME_KEY = Internal.createUniqueKey(TSource.T_SOURCE, DSL.name("t_source_name_key"), new TableField[] { TSource.T_SOURCE.NAME }, true); diff --git a/src/main/java/de/jottyfan/bico/db/Public.java b/src/main/java/de/jottyfan/bico/db/Public.java index 018cbee..8e8e00e 100644 --- a/src/main/java/de/jottyfan/bico/db/Public.java +++ b/src/main/java/de/jottyfan/bico/db/Public.java @@ -7,12 +7,14 @@ package de.jottyfan.bico.db; import de.jottyfan.bico.db.tables.TLesson; import de.jottyfan.bico.db.tables.TLessonSubject; import de.jottyfan.bico.db.tables.TPerson; +import de.jottyfan.bico.db.tables.TProfile; import de.jottyfan.bico.db.tables.TSlot; import de.jottyfan.bico.db.tables.TSource; import de.jottyfan.bico.db.tables.TSubject; import de.jottyfan.bico.db.tables.VCalendar; import de.jottyfan.bico.db.tables.VLesson; import de.jottyfan.bico.db.tables.VLessonMissing; +import de.jottyfan.bico.db.tables.VVersion; import java.util.Arrays; import java.util.List; @@ -50,6 +52,11 @@ public class Public extends SchemaImpl { */ public final TPerson T_PERSON = TPerson.T_PERSON; + /** + * The table public.t_profile. + */ + public final TProfile T_PROFILE = TProfile.T_PROFILE; + /** * The table public.t_slot. */ @@ -80,6 +87,11 @@ public class Public extends SchemaImpl { */ public final VLessonMissing V_LESSON_MISSING = VLessonMissing.V_LESSON_MISSING; + /** + * The table public.v_version. + */ + public final VVersion V_VERSION = VVersion.V_VERSION; + /** * No further instances allowed */ @@ -99,12 +111,14 @@ public class Public extends SchemaImpl { TLesson.T_LESSON, TLessonSubject.T_LESSON_SUBJECT, TPerson.T_PERSON, + TProfile.T_PROFILE, TSlot.T_SLOT, TSource.T_SOURCE, TSubject.T_SUBJECT, VCalendar.V_CALENDAR, VLesson.V_LESSON, - VLessonMissing.V_LESSON_MISSING + VLessonMissing.V_LESSON_MISSING, + VVersion.V_VERSION ); } } diff --git a/src/main/java/de/jottyfan/bico/db/Tables.java b/src/main/java/de/jottyfan/bico/db/Tables.java index 4134f35..8541b9d 100644 --- a/src/main/java/de/jottyfan/bico/db/Tables.java +++ b/src/main/java/de/jottyfan/bico/db/Tables.java @@ -7,12 +7,14 @@ package de.jottyfan.bico.db; import de.jottyfan.bico.db.tables.TLesson; import de.jottyfan.bico.db.tables.TLessonSubject; import de.jottyfan.bico.db.tables.TPerson; +import de.jottyfan.bico.db.tables.TProfile; import de.jottyfan.bico.db.tables.TSlot; import de.jottyfan.bico.db.tables.TSource; import de.jottyfan.bico.db.tables.TSubject; import de.jottyfan.bico.db.tables.VCalendar; import de.jottyfan.bico.db.tables.VLesson; import de.jottyfan.bico.db.tables.VLessonMissing; +import de.jottyfan.bico.db.tables.VVersion; /** @@ -36,6 +38,11 @@ public class Tables { */ public static final TPerson T_PERSON = TPerson.T_PERSON; + /** + * The table public.t_profile. + */ + public static final TProfile T_PROFILE = TProfile.T_PROFILE; + /** * The table public.t_slot. */ @@ -65,4 +72,9 @@ public class Tables { * The table public.v_lesson_missing. */ public static final VLessonMissing V_LESSON_MISSING = VLessonMissing.V_LESSON_MISSING; + + /** + * The table public.v_version. + */ + public static final VVersion V_VERSION = VVersion.V_VERSION; } diff --git a/src/main/java/de/jottyfan/bico/db/tables/TProfile.java b/src/main/java/de/jottyfan/bico/db/tables/TProfile.java new file mode 100644 index 0000000..d400285 --- /dev/null +++ b/src/main/java/de/jottyfan/bico/db/tables/TProfile.java @@ -0,0 +1,153 @@ +/* + * This file is generated by jOOQ. + */ +package de.jottyfan.bico.db.tables; + + +import de.jottyfan.bico.db.Keys; +import de.jottyfan.bico.db.Public; +import de.jottyfan.bico.db.tables.records.TProfileRecord; + +import java.util.Arrays; +import java.util.List; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Identity; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row3; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TProfile extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.t_profile + */ + public static final TProfile T_PROFILE = new TProfile(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return TProfileRecord.class; + } + + /** + * The column public.t_profile.id. + */ + public final TableField ID = createField(DSL.name("id"), SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column public.t_profile.username. + */ + public final TableField USERNAME = createField(DSL.name("username"), SQLDataType.CLOB.nullable(false), this, ""); + + /** + * The column public.t_profile.theme. + */ + public final TableField THEME = createField(DSL.name("theme"), SQLDataType.CLOB.defaultValue(DSL.field("'light'::text", SQLDataType.CLOB)), this, ""); + + private TProfile(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private TProfile(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table()); + } + + /** + * Create an aliased public.t_profile table reference + */ + public TProfile(String alias) { + this(DSL.name(alias), T_PROFILE); + } + + /** + * Create an aliased public.t_profile table reference + */ + public TProfile(Name alias) { + this(alias, T_PROFILE); + } + + /** + * Create a public.t_profile table reference + */ + public TProfile() { + this(DSL.name("t_profile"), null); + } + + public TProfile(Table child, ForeignKey key) { + super(child, key, T_PROFILE); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public Identity getIdentity() { + return (Identity) super.getIdentity(); + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.T_PROFILE_PKEY; + } + + @Override + public List> getUniqueKeys() { + return Arrays.asList(Keys.T_PROFILE_USERNAME_KEY); + } + + @Override + public TProfile as(String alias) { + return new TProfile(DSL.name(alias), this); + } + + @Override + public TProfile as(Name alias) { + return new TProfile(alias, this); + } + + /** + * Rename this table + */ + @Override + public TProfile rename(String name) { + return new TProfile(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public TProfile rename(Name name) { + return new TProfile(name, null); + } + + // ------------------------------------------------------------------------- + // Row3 type methods + // ------------------------------------------------------------------------- + + @Override + public Row3 fieldsRow() { + return (Row3) super.fieldsRow(); + } +} diff --git a/src/main/java/de/jottyfan/bico/db/tables/VVersion.java b/src/main/java/de/jottyfan/bico/db/tables/VVersion.java new file mode 100644 index 0000000..5a31512 --- /dev/null +++ b/src/main/java/de/jottyfan/bico/db/tables/VVersion.java @@ -0,0 +1,122 @@ +/* + * This file is generated by jOOQ. + */ +package de.jottyfan.bico.db.tables; + + +import de.jottyfan.bico.db.Public; +import de.jottyfan.bico.db.tables.records.VVersionRecord; + +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row1; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class VVersion extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of public.v_version + */ + public static final VVersion V_VERSION = new VVersion(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return VVersionRecord.class; + } + + /** + * The column public.v_version.version. + */ + public final TableField VERSION = createField(DSL.name("version"), SQLDataType.INTEGER, this, ""); + + private VVersion(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private VVersion(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.view()); + } + + /** + * Create an aliased public.v_version table reference + */ + public VVersion(String alias) { + this(DSL.name(alias), V_VERSION); + } + + /** + * Create an aliased public.v_version table reference + */ + public VVersion(Name alias) { + this(alias, V_VERSION); + } + + /** + * Create a public.v_version table reference + */ + public VVersion() { + this(DSL.name("v_version"), null); + } + + public VVersion(Table child, ForeignKey key) { + super(child, key, V_VERSION); + } + + @Override + public Schema getSchema() { + return aliased() ? null : Public.PUBLIC; + } + + @Override + public VVersion as(String alias) { + return new VVersion(DSL.name(alias), this); + } + + @Override + public VVersion as(Name alias) { + return new VVersion(alias, this); + } + + /** + * Rename this table + */ + @Override + public VVersion rename(String name) { + return new VVersion(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public VVersion rename(Name name) { + return new VVersion(name, null); + } + + // ------------------------------------------------------------------------- + // Row1 type methods + // ------------------------------------------------------------------------- + + @Override + public Row1 fieldsRow() { + return (Row1) super.fieldsRow(); + } +} diff --git a/src/main/java/de/jottyfan/bico/db/tables/pojos/TProfile.java b/src/main/java/de/jottyfan/bico/db/tables/pojos/TProfile.java new file mode 100644 index 0000000..fda53b2 --- /dev/null +++ b/src/main/java/de/jottyfan/bico/db/tables/pojos/TProfile.java @@ -0,0 +1,70 @@ +/* + * This file is generated by jOOQ. + */ +package de.jottyfan.bico.db.tables.pojos; + + +import java.io.Serializable; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TProfile implements Serializable { + + private static final long serialVersionUID = 1L; + + private final Integer id; + private final String username; + private final String theme; + + public TProfile(TProfile value) { + this.id = value.id; + this.username = value.username; + this.theme = value.theme; + } + + public TProfile( + Integer id, + String username, + String theme + ) { + this.id = id; + this.username = username; + this.theme = theme; + } + + /** + * Getter for public.t_profile.id. + */ + public Integer getId() { + return this.id; + } + + /** + * Getter for public.t_profile.username. + */ + public String getUsername() { + return this.username; + } + + /** + * Getter for public.t_profile.theme. + */ + public String getTheme() { + return this.theme; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("TProfile ("); + + sb.append(id); + sb.append(", ").append(username); + sb.append(", ").append(theme); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/java/de/jottyfan/bico/db/tables/pojos/VVersion.java b/src/main/java/de/jottyfan/bico/db/tables/pojos/VVersion.java new file mode 100644 index 0000000..4416198 --- /dev/null +++ b/src/main/java/de/jottyfan/bico/db/tables/pojos/VVersion.java @@ -0,0 +1,46 @@ +/* + * This file is generated by jOOQ. + */ +package de.jottyfan.bico.db.tables.pojos; + + +import java.io.Serializable; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class VVersion implements Serializable { + + private static final long serialVersionUID = 1L; + + private final Integer version; + + public VVersion(VVersion value) { + this.version = value.version; + } + + public VVersion( + Integer version + ) { + this.version = version; + } + + /** + * Getter for public.v_version.version. + */ + public Integer getVersion() { + return this.version; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("VVersion ("); + + sb.append(version); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/java/de/jottyfan/bico/db/tables/records/TProfileRecord.java b/src/main/java/de/jottyfan/bico/db/tables/records/TProfileRecord.java new file mode 100644 index 0000000..f4d5bfc --- /dev/null +++ b/src/main/java/de/jottyfan/bico/db/tables/records/TProfileRecord.java @@ -0,0 +1,197 @@ +/* + * This file is generated by jOOQ. + */ +package de.jottyfan.bico.db.tables.records; + + +import de.jottyfan.bico.db.tables.TProfile; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record3; +import org.jooq.Row3; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class TProfileRecord extends UpdatableRecordImpl implements Record3 { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.t_profile.id. + */ + public TProfileRecord setId(Integer value) { + set(0, value); + return this; + } + + /** + * Getter for public.t_profile.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for public.t_profile.username. + */ + public TProfileRecord setUsername(String value) { + set(1, value); + return this; + } + + /** + * Getter for public.t_profile.username. + */ + public String getUsername() { + return (String) get(1); + } + + /** + * Setter for public.t_profile.theme. + */ + public TProfileRecord setTheme(String value) { + set(2, value); + return this; + } + + /** + * Getter for public.t_profile.theme. + */ + public String getTheme() { + return (String) get(2); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record3 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row3 fieldsRow() { + return (Row3) super.fieldsRow(); + } + + @Override + public Row3 valuesRow() { + return (Row3) super.valuesRow(); + } + + @Override + public Field field1() { + return TProfile.T_PROFILE.ID; + } + + @Override + public Field field2() { + return TProfile.T_PROFILE.USERNAME; + } + + @Override + public Field field3() { + return TProfile.T_PROFILE.THEME; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public String component2() { + return getUsername(); + } + + @Override + public String component3() { + return getTheme(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public String value2() { + return getUsername(); + } + + @Override + public String value3() { + return getTheme(); + } + + @Override + public TProfileRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public TProfileRecord value2(String value) { + setUsername(value); + return this; + } + + @Override + public TProfileRecord value3(String value) { + setTheme(value); + return this; + } + + @Override + public TProfileRecord values(Integer value1, String value2, String value3) { + value1(value1); + value2(value2); + value3(value3); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached TProfileRecord + */ + public TProfileRecord() { + super(TProfile.T_PROFILE); + } + + /** + * Create a detached, initialised TProfileRecord + */ + public TProfileRecord(Integer id, String username, String theme) { + super(TProfile.T_PROFILE); + + setId(id); + setUsername(username); + setTheme(theme); + } + + /** + * Create a detached, initialised TProfileRecord + */ + public TProfileRecord(de.jottyfan.bico.db.tables.pojos.TProfile value) { + super(TProfile.T_PROFILE); + + if (value != null) { + setId(value.getId()); + setUsername(value.getUsername()); + setTheme(value.getTheme()); + } + } +} diff --git a/src/main/java/de/jottyfan/bico/db/tables/records/VVersionRecord.java b/src/main/java/de/jottyfan/bico/db/tables/records/VVersionRecord.java new file mode 100644 index 0000000..d8f2443 --- /dev/null +++ b/src/main/java/de/jottyfan/bico/db/tables/records/VVersionRecord.java @@ -0,0 +1,109 @@ +/* + * This file is generated by jOOQ. + */ +package de.jottyfan.bico.db.tables.records; + + +import de.jottyfan.bico.db.tables.VVersion; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Row1; +import org.jooq.impl.TableRecordImpl; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class VVersionRecord extends TableRecordImpl implements Record1 { + + private static final long serialVersionUID = 1L; + + /** + * Setter for public.v_version.version. + */ + public VVersionRecord setVersion(Integer value) { + set(0, value); + return this; + } + + /** + * Getter for public.v_version.version. + */ + public Integer getVersion() { + return (Integer) get(0); + } + + // ------------------------------------------------------------------------- + // Record1 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row1 fieldsRow() { + return (Row1) super.fieldsRow(); + } + + @Override + public Row1 valuesRow() { + return (Row1) super.valuesRow(); + } + + @Override + public Field field1() { + return VVersion.V_VERSION.VERSION; + } + + @Override + public Integer component1() { + return getVersion(); + } + + @Override + public Integer value1() { + return getVersion(); + } + + @Override + public VVersionRecord value1(Integer value) { + setVersion(value); + return this; + } + + @Override + public VVersionRecord values(Integer value1) { + value1(value1); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached VVersionRecord + */ + public VVersionRecord() { + super(VVersion.V_VERSION); + } + + /** + * Create a detached, initialised VVersionRecord + */ + public VVersionRecord(Integer version) { + super(VVersion.V_VERSION); + + setVersion(version); + } + + /** + * Create a detached, initialised VVersionRecord + */ + public VVersionRecord(de.jottyfan.bico.db.tables.pojos.VVersion value) { + super(VVersion.V_VERSION); + + if (value != null) { + setVersion(value.getVersion()); + } + } +} diff --git a/src/main/resources/v2.sql b/src/main/resources/v2.sql new file mode 100644 index 0000000..5b91cf8 --- /dev/null +++ b/src/main/resources/v2.sql @@ -0,0 +1,7 @@ +create table t_profile( + id int not null primary key generated always as identity, + username text not null unique, + theme text default 'light'); + +create view v_version as +select 2 as version;