mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 13:35:50 +01:00
(refs #341) Migrate model package.
This commit is contained in:
@@ -1,22 +1,24 @@
|
||||
package model
|
||||
|
||||
import scala.slick.driver.H2Driver.simple._
|
||||
trait SshKeyComponent { self: Profile =>
|
||||
import profile.simple._
|
||||
|
||||
object SshKeys extends Table[SshKey]("SSH_KEY") {
|
||||
def userName = column[String]("USER_NAME")
|
||||
def sshKeyId = column[Int]("SSH_KEY_ID", O AutoInc)
|
||||
def title = column[String]("TITLE")
|
||||
def publicKey = column[String]("PUBLIC_KEY")
|
||||
lazy val SshKeys = TableQuery[SshKeys]
|
||||
|
||||
def ins = userName ~ title ~ publicKey returning sshKeyId
|
||||
def * = userName ~ sshKeyId ~ title ~ publicKey <> (SshKey, SshKey.unapply _)
|
||||
class SshKeys(tag: Tag) extends Table[SshKey](tag, "SSH_KEY") {
|
||||
val userName = column[String]("USER_NAME")
|
||||
val sshKeyId = column[Int]("SSH_KEY_ID", O AutoInc)
|
||||
val title = column[String]("TITLE")
|
||||
val publicKey = column[String]("PUBLIC_KEY")
|
||||
def * = (userName, sshKeyId, title, publicKey) <> (SshKey.tupled, SshKey.unapply)
|
||||
|
||||
def byPrimaryKey(userName: String, sshKeyId: Int) = (this.userName is userName.bind) && (this.sshKeyId is sshKeyId.bind)
|
||||
def byPrimaryKey(userName: String, sshKeyId: Int) = (this.userName is userName.bind) && (this.sshKeyId is sshKeyId.bind)
|
||||
}
|
||||
|
||||
case class SshKey(
|
||||
userName: String,
|
||||
sshKeyId: Int,
|
||||
title: String,
|
||||
publicKey: String
|
||||
)
|
||||
}
|
||||
|
||||
case class SshKey(
|
||||
userName: String,
|
||||
sshKeyId: Int,
|
||||
title: String,
|
||||
publicKey: String
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user