Skip to content

Commit

Permalink
chore: Back to using DAO
Browse files Browse the repository at this point in the history
  • Loading branch information
LichtHund committed Oct 1, 2023
1 parent 8145ca2 commit 7989fdd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions app/src/main/kotlin/database/Tables.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
*/
package dev.triumphteam.docsly.database

import org.jetbrains.exposed.dao.IntEntity
import org.jetbrains.exposed.dao.IntEntityClass
import org.jetbrains.exposed.dao.id.EntityID
import org.jetbrains.exposed.dao.id.IntIdTable
import org.jetbrains.exposed.sql.Column

Expand All @@ -31,3 +34,11 @@ public object DocsTable : IntIdTable() {
public val version: Column<String> = varchar("doc_version", 32).uniqueIndex()
public val guild: Column<Long> = long("guild_id").uniqueIndex()
}

public class DocDao(id: EntityID<Int>) : IntEntity(id) {
public companion object : IntEntityClass<DocDao>(DocsTable)

public var docId: EntityID<Int> by DocsTable.id
public var version: String by DocsTable.version
public var guild: Long by DocsTable.guild
}
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ ktor-client-resources = { module = "io.ktor:ktor-client-resources", version.ref

# DB
exposed = { module = "org.jetbrains.exposed:exposed-jdbc", version.ref = "exposed" }
exposed-jdbc = { module = "org.jetbrains.exposed:exposed-jdbc", version.ref = "exposed" }
exposed-dao = { module = "org.jetbrains.exposed:exposed-dao", version.ref = "exposed" }
hikari = { module = "com.zaxxer:HikariCP", version.ref = "hikari" }
postgres = { module = "com.impossibl.pgjdbc-ng:pgjdbc-ng", version.ref = "postgres" }

Expand Down Expand Up @@ -90,7 +90,7 @@ logger = [
]
database = [
"exposed",
"exposed-jdbc",
"exposed-dao",
"hikari",
"postgres"
]
Expand Down

0 comments on commit 7989fdd

Please sign in to comment.