generator-jhipster
generator-jhipster copied to clipboard
Replace Neo4j Migrations with Liquibase for Neo4j
Signed-off-by: Florent Biville [email protected]
Fix https://github.com/jhipster/generator-jhipster/issues/16315
Please make sure the below checklist is followed for Pull Requests.
- [ ] All continuous integration tests are green
- [ ] Tests are added where necessary
- [ ] The JDL part is updated if necessary
- [ ] jhipster-online is updated if necessary
- [ ] Documentation is added/updated where necessary
- [ ] Coding Rules & Commit Guidelines as per our CONTRIBUTING.md document are followed
When you are still working on the PR, consider converting it to Draft (below reviewers) and adding skip-ci label, you can still see CI build result at your branch.
Still needs to be fully tested (work in progress).
@fbiville Will you have time to revisit this soon?
@mraible I decided to break the support into several phases.
The current approach I have in mind is to just support <loadData> for Neo4j and add an explicit Liquibase change set for Neo4j that takes care of linking the loaded nodes. It will require some refactoring on Liquibase core but we got the POC for this already working on the Neo4j plugin side.
We may revisit the JHipster migration again some time later to automate the linking via <addForeignKeyConstraint>.
@fbiville Can you please fix conflicts when you get a chance?
@fbiville we have now migrated main repository to latest liquibase version (still remaining with old version for H2/mysql/mariadb due to some issues on liquibase), so you can now continue to work on this ;)
@DanielFran Perfect! The changes I needed on the Liquibase core side are also released, so I believe this should finally be ready soon!
Added bug bounty to increase motivation.
Is anyone willing to continue working on this or should we close it?
If we want to do this I can take a look (although I like the neo4j migrations we currently use).
Had just a short call with @fbiville. We agreed to start over with this PR and target it vor v8, so we don't have a breaking change in the 7.x cycle.
Great news! Thanks for the update @atomfrede.
@mraible I will have a look at the neo4j + webflux issue this weekend. I should find some time.
@atomfrede I'm not sure there's still an issue. I'm able to make my reactive-ms.jdl work with 7.9.3. @mshima made some changes to fix things in 7.9.2. The daily builds are failing for Neo4j though.
@fbiville I've created a jhipster + neo4j + liquibase application. The result is:
Liquibase could not start correctly, your database is NOT ready: liquibase.exception.MigrationFailedException: Migration failed for changeset config/liquibase/changelog/00000000000000_initial_schema.xml::00000000000001::jhipster:_ Reason: liquibase.exception.DatabaseException: Invalid input 'TABLE': expected "(", "allShortestPaths" or "shortestPath" (line 1, column 8 (offset: 7))_"CREATE TABLE jhi_user (id VARCHAR(255) NOT NULL, login VARCHAR(50) NOT NULL, password_hash VARCHAR(60), first_name VARCHAR(50), last_name VARCHAR(50), email VARCHAR(191), image_url VARCHAR(256), activated BOOLEAN NOT NULL, lang_key VARCHAR(10), activation_key VARCHAR(20), reset_key VARCHAR(20), created_by VARCHAR(50) NOT NULL, created_date timestamp, reset_date timestamp, last_modified_by VARCHAR(50), last_modified_date timestamp, CONSTRAINT PK_JHI_USER PRIMARY KEY (id), CONSTRAINT ux_user_login UNIQUE (login), CONSTRAINT ux_user_email UNIQUE (email))"_ ^ [Failed SQL: CREATE TABLE jhi_user (id VARCHAR(255) NOT NULL, login VARCHAR(50) NOT NULL, password_hash VARCHAR(60), first_name VARCHAR(50), last_name VARCHAR(50), email VARCHAR(191), image_url VARCHAR(256), activated BOOLEAN NOT NULL, lang_key VARCHAR(10), activation_key VARCHAR(20), reset_key VARCHAR(20), created_by VARCHAR(50) NOT NULL, created_date timestamp, reset_date timestamp, last_modified_by VARCHAR(50), last_modified_date timestamp, CONSTRAINT PK_JHI_USER PRIMARY KEY (id), CONSTRAINT ux_user_login UNIQUE (login), CONSTRAINT ux_user_email UNIQUE (email))]
liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for changeset config/liquibase/changelog/00000000000000_initial_schema.xml::00000000000001::jhipster:
Reason: liquibase.exception.DatabaseException: Invalid input 'TABLE': expected "(", "allShortestPaths" or "shortestPath" (line 1, column 8 (offset: 7))
"CREATE TABLE jhi_user (id VARCHAR(255) NOT NULL, login VARCHAR(50) NOT NULL, password_hash VARCHAR(60), first_name VARCHAR(50), last_name VARCHAR(50), email VARCHAR(191), image_url VARCHAR(256), activated BOOLEAN NOT NULL, lang_key VARCHAR(10), activation_key VARCHAR(20), reset_key VARCHAR(20), created_by VARCHAR(50) NOT NULL, created_date timestamp, reset_date timestamp, last_modified_by VARCHAR(50), last_modified_date timestamp, CONSTRAINT PK_JHI_USER PRIMARY KEY (id), CONSTRAINT ux_user_login UNIQUE (login), CONSTRAINT ux_user_email UNIQUE (email))"
Liquibase changelogs should be reimplemented? Or this is a configuration problem?
@fbiville I've created a jhipster + neo4j + liquibase application. The result is:
Liquibase could not start correctly, your database is NOT ready: liquibase.exception.MigrationFailedException: Migration failed for changeset config/liquibase/changelog/00000000000000_initial_schema.xml::00000000000001::jhipster:_ Reason: liquibase.exception.DatabaseException: Invalid input 'TABLE': expected "(", "allShortestPaths" or "shortestPath" (line 1, column 8 (offset: 7))_"CREATE TABLE jhi_user (id VARCHAR(255) NOT NULL, login VARCHAR(50) NOT NULL, password_hash VARCHAR(60), first_name VARCHAR(50), last_name VARCHAR(50), email VARCHAR(191), image_url VARCHAR(256), activated BOOLEAN NOT NULL, lang_key VARCHAR(10), activation_key VARCHAR(20), reset_key VARCHAR(20), created_by VARCHAR(50) NOT NULL, created_date timestamp, reset_date timestamp, last_modified_by VARCHAR(50), last_modified_date timestamp, CONSTRAINT PK_JHI_USER PRIMARY KEY (id), CONSTRAINT ux_user_login UNIQUE (login), CONSTRAINT ux_user_email UNIQUE (email))"_ ^ [Failed SQL: CREATE TABLE jhi_user (id VARCHAR(255) NOT NULL, login VARCHAR(50) NOT NULL, password_hash VARCHAR(60), first_name VARCHAR(50), last_name VARCHAR(50), email VARCHAR(191), image_url VARCHAR(256), activated BOOLEAN NOT NULL, lang_key VARCHAR(10), activation_key VARCHAR(20), reset_key VARCHAR(20), created_by VARCHAR(50) NOT NULL, created_date timestamp, reset_date timestamp, last_modified_by VARCHAR(50), last_modified_date timestamp, CONSTRAINT PK_JHI_USER PRIMARY KEY (id), CONSTRAINT ux_user_login UNIQUE (login), CONSTRAINT ux_user_email UNIQUE (email))] liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for changeset config/liquibase/changelog/00000000000000_initial_schema.xml::00000000000001::jhipster: Reason: liquibase.exception.DatabaseException: Invalid input 'TABLE': expected "(", "allShortestPaths" or "shortestPath" (line 1, column 8 (offset: 7)) "CREATE TABLE jhi_user (id VARCHAR(255) NOT NULL, login VARCHAR(50) NOT NULL, password_hash VARCHAR(60), first_name VARCHAR(50), last_name VARCHAR(50), email VARCHAR(191), image_url VARCHAR(256), activated BOOLEAN NOT NULL, lang_key VARCHAR(10), activation_key VARCHAR(20), reset_key VARCHAR(20), created_by VARCHAR(50) NOT NULL, created_date timestamp, reset_date timestamp, last_modified_by VARCHAR(50), last_modified_date timestamp, CONSTRAINT PK_JHI_USER PRIMARY KEY (id), CONSTRAINT ux_user_login UNIQUE (login), CONSTRAINT ux_user_email UNIQUE (email))"Liquibase changelogs should be reimplemented? Or this is a configuration problem?
Hello @mshima, this is a configuration issue. There should not be any SQL generated (as the JDBC driver for Neo4j won't understand it, it only understands Cypher).
@mshima has worked on this generated app FYI: https://github.com/mshima/neo4j-liquibase After a few fixes, it seems to be in a working state.
PR is ready https://github.com/jhipster/generator-jhipster/pull/21791.
@atomfrede can I go ahead and close this?
Superseded by https://github.com/jhipster/generator-jhipster/pull/21791
@DanielFran bounty claimed https://opencollective.com/generator-jhipster/expenses/140216.
@mshima approved