feat: DBの定義をコンフィグから生成するように

This commit is contained in:
usbharu 2023-08-15 15:37:56 +09:00
parent 53936455c1
commit dff3397bab
1 changed files with 10 additions and 9 deletions

View File

@ -1,5 +1,6 @@
package dev.usbharu.hideout.repository package dev.usbharu.hideout.repository
import dev.usbharu.hideout.config.Config
import dev.usbharu.hideout.domain.model.hideout.entity.User import dev.usbharu.hideout.domain.model.hideout.entity.User
import dev.usbharu.hideout.service.core.IdGenerateService import dev.usbharu.hideout.service.core.IdGenerateService
import org.jetbrains.exposed.dao.id.LongIdTable import org.jetbrains.exposed.dao.id.LongIdTable
@ -82,16 +83,16 @@ class UserRepositoryImpl(private val database: Database, private val idGenerateS
object Users : Table("users") { object Users : Table("users") {
val id = long("id") val id = long("id")
val name = varchar("name", length = 64) val name = varchar("name", length = Config.configData.characterLimit.account.id)
val domain = varchar("domain", length = 255) val domain = varchar("domain", length = Config.configData.characterLimit.general.domain)
val screenName = varchar("screen_name", length = 64) val screenName = varchar("screen_name", length = Config.configData.characterLimit.account.name)
val description = varchar("description", length = 600) val description = varchar("description", length = Config.configData.characterLimit.account.description)
val password = varchar("password", length = 255).nullable() val password = varchar("password", length = 255).nullable()
val inbox = varchar("inbox", length = 255).uniqueIndex() val inbox = varchar("inbox", length = Config.configData.characterLimit.general.url).uniqueIndex()
val outbox = varchar("outbox", length = 255).uniqueIndex() val outbox = varchar("outbox", length = Config.configData.characterLimit.general.url).uniqueIndex()
val url = varchar("url", length = 255).uniqueIndex() val url = varchar("url", length = Config.configData.characterLimit.general.url).uniqueIndex()
val publicKey = varchar("public_key", length = 10000) val publicKey = varchar("public_key", length = Config.configData.characterLimit.general.publicKey)
val privateKey = varchar("private_key", length = 10000).nullable() val privateKey = varchar("private_key", length = Config.configData.characterLimit.general.privateKey).nullable()
val createdAt = long("created_at") val createdAt = long("created_at")
override val primaryKey: PrimaryKey = PrimaryKey(id) override val primaryKey: PrimaryKey = PrimaryKey(id)