managers relation is fixed (2x)

This commit is contained in:
dalbodeule 2024-08-28 17:02:22 +09:00
parent 447858a48c
commit 1ec899a55a
No known key found for this signature in database
GPG Key ID: EFA860D069C9FA65
2 changed files with 5 additions and 4 deletions

View File

@ -27,6 +27,6 @@ class User(id: EntityID<Int>) : IntEntity(id) {
var liveAlertChannel by Users.liveAlertChannel
var liveAlertMessage by Users.liveAlertMessage
val managers by User referrersOn UserManagers.user
val subordinate by User referrersOn UserManagers.manager
val managers by User.via(UserManagers.manager, UserManagers.user)
val subordinate by User.via(UserManagers.user, UserManagers.manager)
}

View File

@ -1,8 +1,9 @@
package space.mori.chzzk_bot.common.models
import org.jetbrains.exposed.sql.ReferenceOption
import org.jetbrains.exposed.sql.Table
object UserManagers: Table("user_managers") {
val user = reference("user_id", Users)
val manager = reference("manager_id", Users)
val user = reference("user_id", Users, ReferenceOption.CASCADE)
val manager = reference("manager_id", Users, ReferenceOption.CASCADE)
}