Skip to content

Commit

Permalink
chore: Fix Scala 3 migration tests compilation (#577)
Browse files Browse the repository at this point in the history
  • Loading branch information
johanandren authored May 27, 2024
1 parent 00b98ec commit f0a5759
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package akka.persistence.r2dbc.migration

import scala.concurrent.ExecutionContext
import scala.concurrent.Future

import akka.Done
import akka.actor.typed.ActorSystem
import akka.persistence.Persistence
Expand All @@ -15,6 +14,8 @@ import akka.persistence.query.UpdatedDurableState
import akka.persistence.r2dbc.session.scaladsl.R2dbcSession
import akka.persistence.r2dbc.state.scaladsl.ChangeHandler

import scala.annotation.nowarn

class MigrationChangeHandler(system: ActorSystem[_]) extends ChangeHandler[Any] {

private val incrementSql =
Expand All @@ -25,6 +26,7 @@ class MigrationChangeHandler(system: ActorSystem[_]) extends ChangeHandler[Any]

println(incrementSql)

@nowarn("msg=exhaustive")
override def process(session: R2dbcSession, change: DurableStateChange[Any]): Future[Done] = {
println("process changer")
change match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,9 @@ class MigrationToolSpec
"migrate durable state of one persistenceId with change handler" in {
if (hasChangeHandler) {
import akka.persistence.r2dbc.internal.Sql.InterpolationWithAdapter
import r2dbcSettings.codecSettings.DurableStateImplicits._
// Scala 3 needs the extra step here
val durableStateImplicits = r2dbcSettings.codecSettings.DurableStateImplicits
import durableStateImplicits._
val pid = PersistenceId.ofUniqueId(nextPid())
val slice = persistenceExt.sliceForPersistenceId(pid.id)

Expand Down Expand Up @@ -524,7 +526,9 @@ class MigrationToolSpec
"migrate durable state of one persistenceId with additional column" in {
if (hasAdditionalColumn) {
import akka.persistence.r2dbc.internal.Sql.InterpolationWithAdapter
import r2dbcSettings.codecSettings.DurableStateImplicits._
// Scala 3 needs the extra step here
val durableStateImplicits = r2dbcSettings.codecSettings.DurableStateImplicits
import durableStateImplicits._
val pid = PersistenceId.ofUniqueId(nextPid())
persistDurableState(pid, "s-column")
migration.migrateDurableState(pid.id).futureValue shouldBe 1L
Expand Down

0 comments on commit f0a5759

Please sign in to comment.