diff --git a/src/main/resources/update/gitbucket-core_4.11.xml b/src/main/resources/update/gitbucket-core_4.11.xml new file mode 100644 index 0000000..24f1f43 --- /dev/null +++ b/src/main/resources/update/gitbucket-core_4.11.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/main/scala/gitbucket/core/GitBucketCoreModule.scala b/src/main/scala/gitbucket/core/GitBucketCoreModule.scala index 4b9c486..dd8665d 100644 --- a/src/main/scala/gitbucket/core/GitBucketCoreModule.scala +++ b/src/main/scala/gitbucket/core/GitBucketCoreModule.scala @@ -28,5 +28,8 @@ new Version("4.9.0", new LiquibaseMigration("update/gitbucket-core_4.9.xml") ), - new Version("4.10.0") + new Version("4.10.0"), + new Version("4.11.0", + new LiquibaseMigration("update/gitbucket-core_4.11.xml") + ) ) diff --git a/src/main/scala/gitbucket/core/model/DeployKey.scala b/src/main/scala/gitbucket/core/model/DeployKey.scala new file mode 100644 index 0000000..829f256 --- /dev/null +++ b/src/main/scala/gitbucket/core/model/DeployKey.scala @@ -0,0 +1,27 @@ +package gitbucket.core.model + +trait DeployKeyComponent { self: Profile => + import profile.api._ + + lazy val DeployKeys = TableQuery[DeployKeys] + + class DeployKeys(tag: Tag) extends Table[DeployKey](tag, "DEPLOY_KEY") { + val userName = column[String]("USER_NAME") + val repositoryName = column[String]("REPOSITORY_NAME") + val deployKeyId = column[Int]("DEPLOY_KEY_ID", O AutoInc) + val title = column[String]("TITLE") + val publicKey = column[String]("PUBLIC_KEY") + def * = (userName, repositoryName, deployKeyId, title, publicKey) <> (DeployKey.tupled, DeployKey.unapply) + + def byPrimaryKey(userName: String, repositoryName: String, deployKeyId: Int) = + (this.userName === userName.bind) && (this.repositoryName === repositoryName.bind) && (this.deployKeyId === deployKeyId.bind) + } +} + +case class DeployKey( + userName: String, + repositoryName: String, + deployKeyId: Int = 0, + title: String, + publicKey: String +) diff --git a/src/main/scala/gitbucket/core/model/Profile.scala b/src/main/scala/gitbucket/core/model/Profile.scala index ad01a4c..332e7ea 100644 --- a/src/main/scala/gitbucket/core/model/Profile.scala +++ b/src/main/scala/gitbucket/core/model/Profile.scala @@ -54,5 +54,6 @@ with WebHookComponent with WebHookEventComponent with ProtectedBranchComponent + with DeployKeyComponent object Profile extends CoreProfile