Skip to content

Conversation

@remoun
Copy link

@remoun remoun commented Nov 17, 2022

Like forClasspathLocation but with a FileSystemResourceAccessor

@remoun
Copy link
Author

remoun commented Nov 24, 2022

@tomix26 what do you think of this change?

@tomix26
Copy link
Collaborator

tomix26 commented Nov 28, 2022

Thanks for your contribution. I'll have to look at it first and verify the changes. I'll do it as soon as I can, I promise.

@tomix26
Copy link
Collaborator

tomix26 commented Nov 28, 2022

There are some compilation errors, so you can check them out and fix it. Thanks in advance!

liquibase.update(contexts);

// Try and commit the changes.
connection.commit();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this change necessary? I would prefer to keep it as it was. I guess the calling of liquibase.update(contexts) should commit all the changes, right? And the closing logic is already implemented in the finally block.

Copy link
Author

Choose a reason for hiding this comment

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

Unconditionally rolling back in the finally seems incorrect. Closing without committing seems risky, so I added commit + close + set to null

Copy link
Collaborator

Choose a reason for hiding this comment

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

You're right that the previous rolling back logic was incorrect. I've replaced it with a try-with-resources block.

@remoun remoun requested a review from tomix26 November 29, 2022 02:28

import static org.junit.Assert.assertEquals;

public class LiquibasePreparerFileContextTest {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the tests. Now it's much better 👍

Like `forClasspathLocation` but with a `FileSystemResourceAccessor`
@tomix26
Copy link
Collaborator

tomix26 commented Nov 29, 2022

Thanks again for the pull request. I've just tweaked a few details and squashed the commits into a single one for better clarity. And I'm going to release it in the next version.

@tomix26 tomix26 merged commit 27e3f19 into zonkyio:master Nov 29, 2022
@tomix26 tomix26 added this to the 2.0.2 milestone Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants