michael-simons / neo4j-migrations

Automated script runner aka "Migrations" for Neo4j. Inspired by Flyway.
https://michael-simons.github.io/neo4j-migrations/
Apache License 2.0
115 stars 23 forks source link

[Question] Maven-Plugin - Don't find/execute cypher script #776

Closed Raf23 closed 1 year ago

Raf23 commented 1 year ago

Hi,

For a project in Bosa we need to migrate data from GDPR project V1 to V2 (with different shape of data)

We would like to use neo4j-migration.

We are testing the CLI and it works perfectly !

For the usage of maven-plugin we have a problem:

Kind regards,

Raphaël

See below the screen shot:

image

michael-simons commented 1 year ago

Hello @Raf23 thanks for using this project and reaching out. The reason no migrations are found in you scenario is that the plugin looks by default in the target folder, so your project must be compiled and resources be processed before the plugin. The migrate goal binds by default to the pre-integration-test phase, so that is normally done at this point in time.

Please have a look at the following quick video, it's easier than typing it all down:

https://www.youtube.com/watch?v=eupIdAZ16Oo

Here's the project from the vid (I hope the quality improves when YT has processed it)

migrations-maven-plugin.zip

mvn clean process-resources neo4j-migrations:info 

prints:

[INFO] --- neo4j-migrations-maven-plugin:2.0.0:info (default-cli) @ migrations-maven-plugin ---
[INFO] Will search for Cypher scripts in "file:///Users/msimons/Projects/Issues/migrations-maven-plugin/target/classes/neo4j/migrations"
[INFO] Statements will be applied in one transaction per migration
[INFO] 
neo4j@localhost:7687 (Neo4j/4.4.15 Enterprise Edition)
Database: neo4j

+---------+-------------+--------+--------------+----+----------------+---------+-----------------------+
| Version | Description | Type   | Installed on | by | Execution time | State   | Source                |
+---------+-------------+--------+--------------+----+----------------+---------+-----------------------+
| 010     | Whatever    | CYPHER |              |    |                | PENDING | V010__Whatever.cypher |
+---------+-------------+--------+--------------+----+----------------+---------+-----------------------+

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.107 s
[INFO] Finished at: 2022-12-09T16:57:15+01:00
[INFO] ------------------------------------------------------------------------
Raf23 commented 1 year ago

Hello @michael-simons ,

Thanks for all your informations.

All scripts are well in the target folder (even with your project).

image

image

I though the issue was related to windows path... I try to change the path with locationToScan in my pom but without success.

michael-simons commented 1 year ago

@all-contributors please add @Raf23 for bug

allcontributors[bot] commented 1 year ago

@michael-simons

I've put up a pull request to add @Raf23! :tada:

michael-simons commented 1 year ago

Thank you your perseverance and patience! This is indeed a bug. I don't have a windows machine, and these are hard to tackle. Would you be able to try out a snapshot or shall I ping you here next week when I put out a patch?

Raf23 commented 1 year ago

Hi Michael,

No issue, I'm currently not blocked because I'm using the CLI Yes I can test a snapshot for the plugin maven.

Let me know when I can try.

Kind regards,

Raphaël

michael-simons commented 1 year ago

1.15.2 has just been released and should hit central soon. It's a bit easier with the dependencies of the plugin to just include that.

2.0.2 will follow shortly.

I hope this fixes the issue. Thanks again, Raphaël.