Closed jbohman closed 11 months ago
Hi @jbohman , thanks for reporting, looks like I removed the jar file reading capability (unintentionally) which Scala 2 still relies on in the latest update ^^. Will fix asap and try to cover it in a CI job. It went unnoticed because the resources are not packaged into jars in tests.
There is also an alternative way you can pass the resources by hand which still should work. To take the example from the readme like that:
import cats.effect.{IO, IOApp}
import dumbo.{Dumbo, ResourceFilePath}
import natchez.Trace.Implicits.noop
object ExampleApp extends IOApp.Simple {
override def run: IO[Unit] = Dumbo
.withResources[IO](
List(
ResourceFilePath("/db/migration/V1__test.sql"),
ResourceFilePath("/db/migration/V2__test_b.sql"),
ResourceFilePath("/db/migration/V3__test_c.sql"),
)
)
.apply(
sessionResource = skunk.Session.single[IO](
host = "localhost",
port = 5432,
user = "postgres",
database = "postgres",
password = Some("postgres"),
),
defaultSchema = "public",
)
.runMigration
.flatMap { result =>
IO.println(s"Migration completed with ${result.migrationsExecuted} migrations")
}
}
Once the issue is fixed it can be changed to use the location with Dumbo.withResourcesIn[F]("db/migration")
When testing this library we noticed that it was not possible to run it through sbt with scala 2.13.
It results in this exception:
For this code:
After digging a bit it seems like
Paths.get
does not handle jar filesjar:file:/Users/.../target/bg-jobs/sbt_fac89327/job-21/target/92a8dfce/9d592533/test_2.13-27e70d62.jar!/db/migration
Any advice on how to proceed?