Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Fix Scala 3 migration tests compilation #577

Merged
merged 1 commit into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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