From d7bca71cc8806cefc20766475d18529ad680b114 Mon Sep 17 00:00:00 2001 From: "arthur.valin" Date: Tue, 6 Feb 2024 17:03:50 +0100 Subject: [PATCH] try fix pg enums --- .../kotlin/allin/data/postgres/PostgresDataSource.kt | 12 ------------ .../kotlin/allin/data/postgres/entities/BetEntity.kt | 5 ++--- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/Sources/src/main/kotlin/allin/data/postgres/PostgresDataSource.kt b/Sources/src/main/kotlin/allin/data/postgres/PostgresDataSource.kt index f6f6a46..16091b5 100644 --- a/Sources/src/main/kotlin/allin/data/postgres/PostgresDataSource.kt +++ b/Sources/src/main/kotlin/allin/data/postgres/PostgresDataSource.kt @@ -38,18 +38,6 @@ class PostgresDataSource : AllInDataSource() { database.Execute( """ - DO ${'$'}${'$'} - BEGIN - IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'betstatus') THEN - CREATE TYPE IF betstatus AS ENUM - ('InProgress', 'Waiting', 'Closing', 'Finished', 'Cancelled'); - END IF; - IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'bettype') THEN - CREATE TYPE bettype AS ENUM - ('Match', 'Binary', 'Custom'); - END IF; - END${'$'}${'$'}; - CREATE TABLE IF not exists bet ( id uuid PRIMARY KEY, theme VARCHAR(255), diff --git a/Sources/src/main/kotlin/allin/data/postgres/entities/BetEntity.kt b/Sources/src/main/kotlin/allin/data/postgres/entities/BetEntity.kt index c2d740a..6c82b1e 100644 --- a/Sources/src/main/kotlin/allin/data/postgres/entities/BetEntity.kt +++ b/Sources/src/main/kotlin/allin/data/postgres/entities/BetEntity.kt @@ -4,7 +4,6 @@ import allin.model.BetStatus import allin.model.BetType import org.ktorm.entity.Entity import org.ktorm.schema.* -import org.ktorm.support.postgresql.pgEnum import java.time.ZonedDateTime @@ -26,7 +25,7 @@ object BetsEntity : Table("bet") { val endRegistration = timestamp("endregistration") val endBet = timestamp("endbet") val isPrivate = boolean("isprivate").bindTo { it.isPrivate } - val status = pgEnum("status").bindTo { it.status } - val type = pgEnum("type").bindTo { it.type } + val status = enum("status").bindTo { it.status } + val type = enum("type").bindTo { it.type } val createdBy = varchar("createdby").bindTo { it.createdBy } } \ No newline at end of file