chore: migrate to Exposed 1.0.0 and refactor UUID handling
Updated persistence layer to align with Exposed 1.0.0. Refactored table definitions to use `javaUUID` for consistency with `java.util.UUID`. Adjusted transaction handling for compatibility with the latest API changes. Enhanced error handling in database utility functions and refined pagination logic. Added documentation and migration updates for best practices with Exposed 1.0.0.
This commit is contained in:
+6
-4
@@ -1,9 +1,10 @@
|
||||
package at.mocode.events.infrastructure.persistence
|
||||
|
||||
import at.mocode.core.domain.model.SparteE
|
||||
import org.jetbrains.exposed.dao.id.UUIDTable
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.date
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
import org.jetbrains.exposed.v1.core.dao.id.java.UUIDTable
|
||||
import org.jetbrains.exposed.v1.core.kotlin.datetime.date
|
||||
import org.jetbrains.exposed.v1.core.kotlin.datetime.timestamp
|
||||
import org.jetbrains.exposed.v1.core.javaUUID
|
||||
|
||||
/**
|
||||
* Database table definition for events (Veranstaltung) in the event-management context.
|
||||
@@ -24,7 +25,8 @@ object VeranstaltungTable : UUIDTable("veranstaltungen") {
|
||||
|
||||
// Location and Organization
|
||||
val ort = varchar("ort", 255)
|
||||
val veranstalterVereinId = uuid("veranstalter_verein_id")
|
||||
// Migration to Exposed 1.0.0: Use javaUUID for java.util.UUID compatibility
|
||||
val veranstalterVereinId = javaUUID("veranstalter_verein_id")
|
||||
|
||||
// Event Details
|
||||
val sparten = text("sparten") // JSON array of SparteE values
|
||||
|
||||
+6
-5
@@ -2,9 +2,10 @@ package at.mocode.horses.infrastructure.persistence
|
||||
|
||||
import at.mocode.core.domain.model.PferdeGeschlechtE
|
||||
import at.mocode.core.domain.model.DatenQuelleE
|
||||
import org.jetbrains.exposed.dao.id.UUIDTable
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.date
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
import org.jetbrains.exposed.v1.core.dao.id.java.UUIDTable
|
||||
import org.jetbrains.exposed.v1.core.kotlin.datetime.date
|
||||
import org.jetbrains.exposed.v1.core.kotlin.datetime.timestamp
|
||||
import org.jetbrains.exposed.v1.core.javaUUID
|
||||
|
||||
/**
|
||||
* Database table definition for horses in the horse-registry context.
|
||||
@@ -21,8 +22,8 @@ object HorseTable : UUIDTable("horses") {
|
||||
val farbe = varchar("farbe", 100).nullable()
|
||||
|
||||
// Ownership and Responsibility
|
||||
val besitzerId = uuid("besitzer_id").nullable()
|
||||
val verantwortlichePersonId = uuid("verantwortliche_person_id").nullable()
|
||||
val besitzerId = javaUUID("besitzer_id").nullable()
|
||||
val verantwortlichePersonId = javaUUID("verantwortliche_person_id").nullable()
|
||||
|
||||
// Breeding Information
|
||||
val zuechterName = varchar("zuechter_name", 255).nullable()
|
||||
|
||||
+6
-5
@@ -1,8 +1,9 @@
|
||||
package at.mocode.masterdata.infrastructure.persistence
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.datetime
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.CurrentDateTime
|
||||
import org.jetbrains.exposed.v1.core.Table
|
||||
import org.jetbrains.exposed.v1.core.kotlin.datetime.datetime
|
||||
import org.jetbrains.exposed.v1.core.kotlin.datetime.CurrentDateTime
|
||||
import org.jetbrains.exposed.v1.core.javaUUID
|
||||
|
||||
/**
|
||||
* Exposed-Tabellendefinition für die Altersklasse-Entität (Altersklassendefinitionen).
|
||||
@@ -11,7 +12,7 @@ import org.jetbrains.exposed.sql.kotlin.datetime.CurrentDateTime
|
||||
* entsprechend der AltersklasseDefinition Domain-Entität.
|
||||
*/
|
||||
object AltersklasseTable : Table("altersklasse") {
|
||||
val id = uuid("id").autoGenerate()
|
||||
val id = javaUUID("id").autoGenerate()
|
||||
val altersklasseCode = varchar("altersklasse_code", 50).uniqueIndex()
|
||||
val bezeichnung = varchar("bezeichnung", 200)
|
||||
val minAlter = integer("min_alter").nullable()
|
||||
@@ -19,7 +20,7 @@ object AltersklasseTable : Table("altersklasse") {
|
||||
val stichtagRegelText = varchar("stichtag_regel_text", 500).nullable()
|
||||
val sparteFilter = varchar("sparte_filter", 50).nullable() // Enum as string
|
||||
val geschlechtFilter = char("geschlecht_filter").nullable()
|
||||
val oetoRegelReferenzId = uuid("oeto_regel_referenz_id").nullable()
|
||||
val oetoRegelReferenzId = javaUUID("oeto_regel_referenz_id").nullable()
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val createdAt = datetime("created_at").defaultExpression(CurrentDateTime)
|
||||
val updatedAt = datetime("updated_at").defaultExpression(CurrentDateTime)
|
||||
|
||||
+6
-5
@@ -1,8 +1,9 @@
|
||||
package at.mocode.masterdata.infrastructure.persistence
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.datetime
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.CurrentDateTime
|
||||
import org.jetbrains.exposed.v1.core.Table
|
||||
import org.jetbrains.exposed.v1.core.kotlin.datetime.datetime
|
||||
import org.jetbrains.exposed.v1.core.kotlin.datetime.CurrentDateTime
|
||||
import org.jetbrains.exposed.v1.core.javaUUID
|
||||
|
||||
/**
|
||||
* Exposed-Tabellendefinition für die Bundesland-Entität (Bundesländer/Regionen).
|
||||
@@ -11,8 +12,8 @@ import org.jetbrains.exposed.sql.kotlin.datetime.CurrentDateTime
|
||||
* Verwaltungseinheiten entsprechend der BundeslandDefinition Domain-Entität.
|
||||
*/
|
||||
object BundeslandTable : Table("bundesland") {
|
||||
val id = uuid("id").autoGenerate()
|
||||
val landId = uuid("land_id").references(LandTable.id)
|
||||
val id = javaUUID("id").autoGenerate()
|
||||
val landId = javaUUID("land_id").references(LandTable.id)
|
||||
val oepsCode = varchar("oeps_code", 10).nullable()
|
||||
val iso3166_2_Code = varchar("iso_3166_2_code", 10).nullable()
|
||||
val name = varchar("name", 100)
|
||||
|
||||
+5
-4
@@ -1,8 +1,9 @@
|
||||
package at.mocode.masterdata.infrastructure.persistence
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.datetime
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.CurrentDateTime
|
||||
import org.jetbrains.exposed.v1.core.Table
|
||||
import org.jetbrains.exposed.v1.core.kotlin.datetime.datetime
|
||||
import org.jetbrains.exposed.v1.core.kotlin.datetime.CurrentDateTime
|
||||
import org.jetbrains.exposed.v1.core.javaUUID
|
||||
|
||||
/**
|
||||
* Exposed-Tabellendefinition für die Land-Entität (Länderstammdaten).
|
||||
@@ -11,7 +12,7 @@ import org.jetbrains.exposed.sql.kotlin.datetime.CurrentDateTime
|
||||
* der LandDefinition Domain-Entität.
|
||||
*/
|
||||
object LandTable : Table("land") {
|
||||
val id = uuid("id").autoGenerate()
|
||||
val id = javaUUID("id").autoGenerate()
|
||||
val isoAlpha2Code = varchar("iso_alpha2_code", 2).uniqueIndex()
|
||||
val isoAlpha3Code = varchar("iso_alpha3_code", 3).uniqueIndex()
|
||||
val isoNumerischerCode = varchar("iso_numerischer_code", 3).nullable()
|
||||
|
||||
+6
-5
@@ -1,8 +1,9 @@
|
||||
package at.mocode.masterdata.infrastructure.persistence
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.datetime
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.CurrentDateTime
|
||||
import org.jetbrains.exposed.v1.core.Table
|
||||
import org.jetbrains.exposed.v1.core.kotlin.datetime.datetime
|
||||
import org.jetbrains.exposed.v1.core.kotlin.datetime.CurrentDateTime
|
||||
import org.jetbrains.exposed.v1.core.javaUUID
|
||||
|
||||
/**
|
||||
* Exposed-Tabellendefinition für die Platz-Entität (Turnierplätze/Wettkampfstätten).
|
||||
@@ -11,8 +12,8 @@ import org.jetbrains.exposed.sql.kotlin.datetime.CurrentDateTime
|
||||
* entsprechend der Platz Domain-Entität.
|
||||
*/
|
||||
object PlatzTable : Table("platz") {
|
||||
val id = uuid("id").autoGenerate()
|
||||
val turnierId = uuid("turnier_id") // Foreign key to tournament (not enforced here as tournament might be in different module)
|
||||
val id = javaUUID("id").autoGenerate()
|
||||
val turnierId = javaUUID("turnier_id") // Foreign key to tournament (not enforced here as tournament might be in different module)
|
||||
val name = varchar("name", 200)
|
||||
val dimension = varchar("dimension", 50).nullable()
|
||||
val boden = varchar("boden", 100).nullable()
|
||||
|
||||
Reference in New Issue
Block a user