Skip to content

SqlMigrations don't work with slick-migration-api-flyway #98

@PawelLipski

Description

@PawelLipski

Since the result of slick.migration.api.SqlMigration.apply doesn't override toString, the generated description of a SqlMigration looks like SqlMigration$$anon$1@5becf99e, and is a different string each time a new object is created (incl. when a new JVM is launched).

This leads to Flyway failing with ``Migration description mismatch for migration version ...`.

As a workaround, once could do sth like:

    val initialSchema = new SqlMigration {
      override def sql: Seq[String] = Seq(Source.fromResource("initial-schema.sql").mkString)

      override def toString: String = s"${classOf[SqlMigration].getSimpleName}(${sql})"
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions