mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 21:45:50 +01:00
(refs #115)Add table and model to store public keys
This commit is contained in:
@@ -1 +1,10 @@
|
|||||||
ALTER TABLE GROUP_MEMBER ADD COLUMN MANAGER BOOLEAN DEFAULT FALSE;
|
ALTER TABLE GROUP_MEMBER ADD COLUMN MANAGER BOOLEAN DEFAULT FALSE;
|
||||||
|
|
||||||
|
CREATE TABLE SSH_KEY (
|
||||||
|
USER_NAME VARCHAR(100) NOT NULL,
|
||||||
|
SSH_KEY_ID INT AUTO_INCREMENT,
|
||||||
|
PUBLIC_KEY TEXT NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE SSH_KEY ADD CONSTRAINT IDX_SSH_KEY_PK PRIMARY KEY (USER_NAME, SSH_KEY_ID);
|
||||||
|
ALTER TABLE SSH_KEY ADD CONSTRAINT IDX_SSH_KEY_FK0 FOREIGN KEY (USER_NAME) REFERENCES ACCOUNT (USER_NAME);
|
||||||
|
|||||||
18
src/main/scala/model/SshKey.scala
Normal file
18
src/main/scala/model/SshKey.scala
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import scala.slick.driver.H2Driver.simple._
|
||||||
|
|
||||||
|
object SshKeys extends Table[SshKey]("SSH_KEY") {
|
||||||
|
def userName = column[String]("USER_NAME")
|
||||||
|
def sshKeyId = column[Int]("SSH_KEY")
|
||||||
|
def publicKey = column[String]("PUBLIC_KEY")
|
||||||
|
def * = userName ~ sshKeyId ~ publicKey <> (SshKey, SshKey.unapply _)
|
||||||
|
|
||||||
|
def byPrimaryKey(userName: String, sshKeyId: Int) = (this.userName is userName.bind) && (this.sshKeyId is sshKeyId.bind)
|
||||||
|
}
|
||||||
|
|
||||||
|
case class SshKey(
|
||||||
|
userName: String,
|
||||||
|
sshKeyId: Int,
|
||||||
|
publicKey: String
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user