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

Add spring.modulith.events.jdbc.schema to allow defining which database schema the event_publication table resides in #685

Closed
odrotbohm opened this issue Jun 25, 2024 · 4 comments
Assignees
Labels
in: event publication registry Event publication registry type: improvement Minor improvements
Milestone

Comments

@odrotbohm
Copy link
Member

As described in GH-683, it might be desirable to define the schema for the event_publication table explicitly. We could introduce a spring.modulith.events.jdbc.schema property to allow easy configuration of that.

Required steps

  • Introduce the property in src/main/resources/META-INF/spring-configuration-metadata.json
  • Wire the value into JbcEventPublicationRepository
  • Change the way that the SQL statements are used to augment the table name with the configured schema
  • Update documentation accordingly (primarily src/docs/antora/mopdules/ROOT/pages/appendix.adoc)
  • Optional: introduced Spring Boot configuration properties class JdbcConfigurationProperties and use that from the repository implementation. This would allow us to get rid of the manually maintained spring-configuration-metadata.json in favor of using the configuration class processor to create the metadata automatically.
@odrotbohm odrotbohm added in: event publication registry Event publication registry meta: contributions welcome Good for newcomers type: improvement Minor improvements meta: first timers only Tickets suitable for folks new to contributing to OSS labels Jun 25, 2024
@raedbh
Copy link
Contributor

raedbh commented Jul 4, 2024

What is the expected behavior when configuring the schema property for a MySQL database?

raedbh added a commit to raedbh/spring-modulith that referenced this issue Jul 6, 2024
…to allow defining the database schema for the event_publication table.
@odrotbohm
Copy link
Member Author

Thanks for the contribution. I will have a look at your PR. Assigning you in the meantime so that nobody else accidentally starts working on it.

@odrotbohm odrotbohm removed meta: contributions welcome Good for newcomers meta: first timers only Tickets suitable for folks new to contributing to OSS labels Jul 8, 2024
@odrotbohm odrotbohm added this to the 1.3 M1 milestone Jul 8, 2024
odrotbohm pushed a commit that referenced this issue Jul 9, 2024
…ng the database schema for the event_publication table.
odrotbohm added a commit that referenced this issue Jul 9, 2024
Disable schema support for MySQL as it doesn't know about schemas per database.

General polishing.
@odrotbohm
Copy link
Member Author

I've applied the PR but actively reject setting the schema for MySQL as it doesn't know about schemas per database. The test for the functionality were flaky and working accidentally if the “no schema configured” ones ran first, as Testcontainers ignores the database name for hostless DB configuration and sets the DB name to test. That in turn accidentally matches the allegedly custom schema.

Thanks for the contribution! 🙇

odrotbohm added a commit that referenced this issue Jul 9, 2024
Disable schema support for MySQL as it doesn't know about schemas per database.

General polishing.
@raedbh
Copy link
Contributor

raedbh commented Jul 9, 2024

This was exactly the doubtful part I raised in my question above 😅. In MySQL, the 'schema' refers to the database itself..

Thank you for applying the PR and for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: event publication registry Event publication registry type: improvement Minor improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants