Skip to content
This repository has been archived by the owner on Jul 22, 2020. It is now read-only.

Add support for additional resolvers and locate local classes in Kotlin #82

Open
mkobit opened this issue Mar 15, 2019 · 1 comment
Open

Comments

@mkobit
Copy link
Contributor

mkobit commented Mar 15, 2019

Outcome Desired

Ability to extend and implement how migrations are discovered.


Definition of Done

  • Can implement and supply custom migrations
  • Classpath scanning detects local classes

Out of Scope


How to Demo

When trying to evaluate this tool, I wrote a local Kotlin class to experiment with Java-based migrations:

    @DisplayName("com.hhandoko:cassandra-migration:0.15 : https://github.com/hhandoko/cassandra-migration")
    @Test
    fun `trying out hhandoko_cassandra-migration`() {
        // local classes don't work with cassandra-migration classpath scanning mechanism
        class V2__AddDataPointMigration : JavaMigration {
            override fun migrate(session: Session) {
                session.execute("""
                    INSERT into Data (account, id, data) VALUES
                    (
                        628d17b8-7f67-4bba-8e89-dadbdb6769e0,
                        0,
                        textAsBlob('70696e656170706c652070697a7a6120697320612073696e')
                    )
                """.trimIndent())
            }
        }

Unfortunately, this class does not get discovered by scanning techniques.

@mkobit
Copy link
Contributor Author

mkobit commented Mar 15, 2019

There is a big commented out section in CassandraMigrationConfiguration

//    /**
//     * Retrieves the the custom MigrationResolvers to be used in addition to the built-in ones for resolving migrations to apply.
//     *
//     * @return The custom MigrationResolvers to be used in addition to the built-in ones for resolving migrations to apply.
//     *         An empty array if none.
//     *         (default: none)
//     */
//    val resolvers: Array<MigrationResolver>

That makes me think this feature was eventually planned, but just not implemented yet.

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

No branches or pull requests

1 participant