Skip to content

Commit

Permalink
Merge pull request #1112 from digitalfabrik/upgrade-backend
Browse files Browse the repository at this point in the history
Upgrade backend dependencies
  • Loading branch information
michael-markl authored Sep 4, 2023
2 parents 6665314 + 007abaf commit 7da7451
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion administration/public/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="de">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
Expand Down
16 changes: 8 additions & 8 deletions backend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ val exposedVersion: String by project

plugins {
// Apply the Kotlin JVM plugin to add support for Kotlin.
id("org.jetbrains.kotlin.jvm") version "1.8.22"
id("org.jlleitschuh.gradle.ktlint") version "11.4.1"
id("org.jetbrains.kotlin.jvm") version "1.9.10"
id("org.jlleitschuh.gradle.ktlint") version "11.5.1"

// Apply the application plugin to add support for building a CLI application.
application
Expand All @@ -24,11 +24,11 @@ repositories {

dependencies {
implementation("com.github.ajalt.clikt:clikt:3.5.4")
implementation("io.javalin:javalin:5.6.0")
implementation("io.javalin:javalin:5.6.2")
implementation("com.google.code.gson:gson:2.10.1")
implementation("org.slf4j:slf4j-simple:2.0.7")
implementation("org.apache.commons:commons-text:1.10.0")
implementation("org.simplejavamail:simple-java-mail:8.1.1")
implementation("org.simplejavamail:simple-java-mail:8.1.3")

implementation("com.expediagroup:graphql-kotlin-schema-generator:6.5.3")
implementation("com.graphql-java:graphql-java-extended-scalars:20.2")
Expand All @@ -37,8 +37,8 @@ dependencies {

// Use the Kotlin JDK 8 standard library.
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("io.ktor:ktor-client-core-jvm:2.3.1")
implementation("io.ktor:ktor-client-cio-jvm:2.3.1")
implementation("io.ktor:ktor-client-core-jvm:2.3.4")
implementation("io.ktor:ktor-client-cio-jvm:2.3.4")

// Use the Kotlin test library.
testImplementation("org.jetbrains.kotlin:kotlin-test")
Expand All @@ -51,8 +51,8 @@ dependencies {
implementation("org.jetbrains.exposed:exposed-jdbc:$exposedVersion")
implementation("org.jetbrains.exposed:exposed-java-time:$exposedVersion")
implementation("org.postgresql:postgresql:42.6.0")
implementation("com.kohlschutter.junixsocket:junixsocket-core:2.6.2")
implementation("com.kohlschutter.junixsocket:junixsocket-common:2.6.2")
implementation("com.kohlschutter.junixsocket:junixsocket-core:2.7.0")
implementation("com.kohlschutter.junixsocket:junixsocket-common:2.7.0")

implementation("net.postgis:postgis-jdbc:2021.1.0")

Expand Down
2 changes: 1 addition & 1 deletion backend/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Properties to configure the gradle build

exposedVersion=0.41.1
exposedVersion=0.43.0
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package app.ehrenamtskarte.backend.migration

import app.ehrenamtskarte.backend.migration.database.Migrations
import app.ehrenamtskarte.backend.migration.migrations.MigrationsRegistry
import org.jetbrains.exposed.sql.ColumnDiff
import org.jetbrains.exposed.sql.SchemaUtils
import org.jetbrains.exposed.sql.Table
import org.jetbrains.exposed.sql.transactions.TransactionManager
Expand Down Expand Up @@ -53,7 +52,7 @@ fun assertDatabaseIsInSync() {
}
}

val statements = statementsRequiredToActualizeScheme(*allTables) + dropExcessiveColumns(*allTables)
val statements = SchemaUtils.statementsRequiredToActualizeScheme(*allTables) + dropExcessiveColumns(*allTables)
if (statements.isNotEmpty() || outOfSyncComment != null) {
throw DatabaseOutOfSyncException(statements, comment = outOfSyncComment)
}
Expand All @@ -80,27 +79,3 @@ private fun dropExcessiveColumns(vararg tables: Table): List<String> {

return statements
}

/**
* Workaround for https://github.com/JetBrains/Exposed/issues/1486
*/
internal fun statementsRequiredToActualizeScheme(vararg tables: Table): List<String> {
val statements = SchemaUtils.statementsRequiredToActualizeScheme(*tables)
val existingColumnsByTable = currentDialect.tableColumns(*tables)
val allColumns = tables.map { table -> table.columns }.flatten()
val problematicColumns = allColumns.filter { column ->
val hasDefaultInCode = column.descriptionDdl().contains("DEFAULT (CURRENT_TIMESTAMP)")
val existingColumn = existingColumnsByTable[column.table]?.singleOrNull {
column.name.equals(it.name, true)
}
val hasDefaultInDb = existingColumn?.defaultDbValue == "CURRENT_TIMESTAMP"
hasDefaultInCode && hasDefaultInDb
}
val problematicStatements = problematicColumns.map {
currentDialect.modifyColumn(
it,
ColumnDiff(defaults = true, nullability = false, autoInc = false, caseSensitiveName = false)
).single()
}
return statements.filter { it !in problematicStatements }
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ class CardMutationService {
val cardHash = Base64.getDecoder().decode(cardInfoHashBase64)
val rawActivationSecret = Base64.getDecoder().decode(activationSecretBase64)
// Avoid race conditions when activating a card.
return transaction(TRANSACTION_REPEATABLE_READ, repetitionAttempts = 0) t@{
return transaction(TRANSACTION_REPEATABLE_READ) t@{
repetitionAttempts = 0
val card = CardRepository.findByHash(project, cardHash)
val activationSecretHash = card?.activationSecretHash

Expand Down

0 comments on commit 7da7451

Please sign in to comment.