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

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

Open
PawelLipski opened this issue Sep 28, 2020 · 5 comments
Open

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

PawelLipski opened this issue Sep 28, 2020 · 5 comments

Comments

@PawelLipski
Copy link

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})"
    }
@nafg
Copy link
Owner

nafg commented Dec 3, 2020

What do you recommend?

@PawelLipski
Copy link
Author

Well... if you could just override toString in trait SqlMigration :)

@nafg
Copy link
Owner

nafg commented Dec 3, 2020 via email

@PawelLipski
Copy link
Author

Hmmm same as in my implementation?... Possibly with getName instead of getSimpleName 🤔

@nafg
Copy link
Owner

nafg commented Dec 3, 2020

Could you send a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants