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

Implement multi-schema support #727

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

philipp-kleber-avelios
Copy link
Contributor

These changes are an initial experiment to resolve issue #248, by allowing multiple schemas during the snapshot.
I added a new test HibernateMultiSchemaTest.java, which currently only checks the exit code of such a multi-schema diffChangelog command.

If somebody could review the code and maybe give their input if the changes are sufficient or if additional ones are required, that would be great, thanks!.

Copy link
Contributor

@MalloD12 MalloD12 left a comment

Choose a reason for hiding this comment

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

Approved.

Besides the minor comment I posted this looks good to me. Thank you, @philipp-kleber-avelios for contributing with this PR.

Daniel.

Copy link
Collaborator

@filipelautert filipelautert 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 improvement @philipp-kleber-avelios !
@tati-qalified if you need any ideas on how to test it please let me know.

Copy link

@tati-qalified tati-qalified left a comment

Choose a reason for hiding this comment

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

Thank you @philipp-kleber-avelios for your contribution!
I was wondering if the entities for the test could be narrowed down, I don't think it's necessary to create 13 classes just for one test case.

@@ -34,6 +34,10 @@ protected void addTo(DatabaseObject foundObject, DatabaseSnapshot snapshot) thro
Schema schema = (Schema) foundObject;
HibernateDatabase database = (HibernateDatabase) snapshot.getDatabase();
for (org.hibernate.boot.model.relational.Namespace namespace : database.getMetadata().getDatabase().getNamespaces()) {
if (!schemaMatchesNamespace(schema, namespace)) {
continue;

Choose a reason for hiding this comment

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

@philipp-kleber-avelios in this piece of code it's checking if the schema doesn't match the namespace, but then it does nothing either way. Did you mean to add something else inside the if block? If not, it should be removed

Table table = new Table().setName(hibernateTable.getName());
Scope.getCurrentScope().getLog(getClass()).info("Found table " + table.getName());
if (!schemaMatchesTable(example, hibernateTable)) {
Scope.getCurrentScope().getLog(getClass()).info("Skipping table " + hibernateTable.getName() + " for schema " + example.getSchema().getName() + ", because it is part of another one.");

Choose a reason for hiding this comment

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

The last part because it is part of another one isn't too clear, I'd change it to because it belongs to a different schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Test
Development

Successfully merging this pull request may close these issues.

5 participants