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

TOMEE-1380 - add examples for liquibase/flyway usage #1525

Merged
merged 13 commits into from
Oct 4, 2024

Conversation

jrxxjr
Copy link
Contributor

@jrxxjr jrxxjr commented Sep 28, 2024

Added the example of the use Flyway and Liquibase tool, via programmatically and via maven plugin

Copy link
Member

@Daniel-Dos Daniel-Dos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good, thanks.

Copy link
Member

@jungm jungm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome PR, we can always need more examples that guide users! I've annotated a few minor things I'd like to see changed, then we can merge this IMO

examples/import-database-flyway-maven/README.adoc Outdated Show resolved Hide resolved
examples/import-database-flyway-maven/pom.xml Outdated Show resolved Hide resolved
examples/import-database-flyway-maven/pom.xml Outdated Show resolved Hide resolved
examples/import-database-flyway-maven/pom.xml Outdated Show resolved Hide resolved
examples/import-database-flyway/pom.xml Outdated Show resolved Hide resolved
examples/import-database-liquibase-maven/pom.xml Outdated Show resolved Hide resolved
examples/import-database-liquibase/.gitignore Show resolved Hide resolved
examples/import-database-liquibase-maven/README.adoc Outdated Show resolved Hide resolved
@jungm jungm changed the title Tomee 1380 TOMEE-1380 - add examples for liquibase/flyway usage Sep 28, 2024
@jrxxjr
Copy link
Contributor Author

jrxxjr commented Sep 28, 2024 via email

…the use Liquibase tool, via programmatically and via maven plugin
…the use Liquibase tool, via programmatically and via maven plugin
Copy link
Member

@jungm jungm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a few more small changes from my side, most of which are cleaning up POMs and READMEs

examples/import-database-flyway-maven/pom.xml Outdated Show resolved Hide resolved
examples/import-database-flyway/README.adoc Outdated Show resolved Hide resolved
examples/import-database-flyway/pom.xml Outdated Show resolved Hide resolved
examples/import-database-flyway/pom.xml Outdated Show resolved Hide resolved
examples/import-database-liquibase-maven/pom.xml Outdated Show resolved Hide resolved
examples/import-database-liquibase-maven/pom.xml Outdated Show resolved Hide resolved
examples/import-database-liquibase/README.adoc Outdated Show resolved Hide resolved
examples/import-database-liquibase/pom.xml Outdated Show resolved Hide resolved
examples/import-database-liquibase/pom.xml Outdated Show resolved Hide resolved
…the use Liquibase tool, via programmatically and via maven plugin
…the use Liquibase tool, via programmatically and via maven plugin
@jrxxjr jrxxjr requested a review from jungm September 29, 2024 12:56
Copy link
Contributor

@rzo1 rzo1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Please find some comments / feedback.

@@ -17,6 +17,70 @@

package org.apache.openejb.assembler.classic;

import static org.apache.openejb.util.Classes.ancestors;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we revert this change in import order? It doesn't actually contribute to the change set.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not understand correctly, what do you mean ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import ordering of the Assembler class was changed for no reason. I think, it was done by auto formatting of your IDE. Just restore the previous order of the import statements.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will return the imports that are in the master branch.

@@ -122,8 +122,13 @@ public EntityManagerFactory call() throws Exception {
emf.createEntityManager().close();
}

/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

@@ -90,6 +101,11 @@ public static class Something {
private long id;
}

/*
* The code below should no longer be used, because the ImportSql class, is no
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment can be dropped.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

Flyway flyway = Flyway.configure().locations("filesystem:src/test/resources").dataSource(dataSource)
.cleanDisabled(false).load();

flyway.clean();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might not be a good idea to suggest to use clean ;-) - if you do that in a productive app, you need to restore from backup.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, i will change.

<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>5.1.0</version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6.0.0 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, i will change.

examples/import-database-liquibase-maven/pom.xml Outdated Show resolved Hide resolved
…the use Liquibase tool, via programmatically and via maven plugin
…the use Liquibase tool, via programmatically and via maven plugin
@jrxxjr jrxxjr requested a review from rzo1 October 3, 2024 01:46
Copy link
Contributor

@rzo1 rzo1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only have two points:

  • (1) Please revert the changes in import order and any formatting in classes, which aren't changed. These Changes are still in the changeset.

  • (2) Please reduce the amount of copy paste comments. Duplicating the same comments about the deprecation of a class is Not necessary. IDE will highlight the deprecation anyway, so it is enough to have it in ImportSql itself.

Otherwise, looks good to me

@jrxxjr
Copy link
Contributor Author

jrxxjr commented Oct 3, 2024

Responding to your observations:
(1) - I returned the order of the imports you requested, from the Assembler.java class, as it was in the master branch.
The code formatting is the Eclipse IDE standard, I didn't change that.
(2) - So i should only put comments in the ImportSql class, i don't need to put them in the javadoc in the ImportSqlScriptTest test class, nor in the coding of the Assember class ?

@jrxxjr jrxxjr requested a review from rzo1 October 3, 2024 12:05
@rzo1
Copy link
Contributor

rzo1 commented Oct 3, 2024

  • (1) Yep, I know it can happen easily. We don't have checkstyle in TomEE but changing import order or formatting at all due to auto formatting just makes the diff harder to read and doesn't bring much value. Therefore, I prefer to not touch it ;-)

  • (2) Yes.

@jrxxjr
Copy link
Contributor Author

jrxxjr commented Oct 3, 2024

(1) - Wouldn't it be better to create a checkstyle in TomEE, so that anyone who changes the code, the formatting would always be forced on everyone, and this problem would not happen ?
(2) - Ok.

@rzo1
Copy link
Contributor

rzo1 commented Oct 3, 2024

In a perfect world, enforcing style and providing formatting profiles for IntelliJ and Eclipse would be beneficial, yes.

But there are more sophisticated challenges atm, imho (one would need to start a discussion and find consensus about a common style, etc).

@jrxxjr
Copy link
Contributor Author

jrxxjr commented Oct 3, 2024

In a perfect world, enforcing style and providing formatting profiles for IntelliJ and Eclipse would be beneficial, yes.

But there are more sophisticated challenges atm, imho (one would need to start a discussion and find consensus about a common style, etc).

Ok.

…the use Liquibase tool, via programmatically and via maven plugin
@rzo1 rzo1 merged commit 3fe0c4f into apache:main Oct 4, 2024
1 check passed
@rzo1
Copy link
Contributor

rzo1 commented Oct 4, 2024

Thanks for the examples and the PR, @jrxxjr !!

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

Successfully merging this pull request may close these issues.

4 participants