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

Non-embedded databases have schema/data.sql scripts applied by default #26682

Closed
everflux opened this issue May 27, 2021 · 5 comments
Closed
Assignees
Labels
status: noteworthy A noteworthy issue to call out in the release notes type: regression A regression from a previous release
Milestone

Comments

@everflux
Copy link

everflux commented May 27, 2021

In my project I have mariadb and h2 dependencies and data.sql/schema.sql.
For development h2 is used, a 'dev' profile is used without spring.datasource.* properties and a 'prod' profile sets the properties for mariadb.

Before Spring Boot 2.5.0 the behaviour was to use schema.sql and data.sql for h2, but not for mariadb.
In Spring Boot 2.5.0 the schema.sql and data.sql are executed on each application start/reload.

While this change is surprising there may be good reasons for it, but it should be documented in a prominent manner, as it could lead to problems with production data.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 27, 2021
@philwebb
Copy link
Member

Thanks for the feedback. This is an unfortunate use-case that we didn't completely consider when we redesigned the code. I've update our release notes to add a warning. Please let me know you think that doesn't cover it.

I'll flag this issue for team attention to see if there's anything else that we can do to try an improve the situation.

@philwebb philwebb added the for: team-meeting An issue we'd like to discuss as a team to make progress label May 27, 2021
@nfrankel
Copy link

I think the main issue is moving from a ternary value to a binary one (https://twitter.com/nicolas_frankel/status/1397182454029602822).

You can do less damage by having the default set to false. The reasoning is that it's better to not initialize the development database than to initialize the production one. You'll spend time investigating the issue in both cases, but in the former, you probably are in less of a hurry than in the latter.

@philwebb philwebb added type: bug A general bug and removed for: team-meeting An issue we'd like to discuss as a team to make progress status: waiting-for-triage An issue we've not yet triaged labels Jun 7, 2021
@philwebb philwebb added this to the 2.5.x milestone Jun 7, 2021
@philwebb
Copy link
Member

philwebb commented Jun 7, 2021

We're going to try to restore the enum support, although we might not be able to support that with R2DBC

@philwebb philwebb added type: regression A regression from a previous release and removed type: bug A general bug labels Jun 7, 2021
@everflux
Copy link
Author

everflux commented Jun 7, 2021

Thanks a lot for taking care and discussing the issue.

Will the detection of embedded or non-embedded database be available again and data/schema.sql only be running with embedded by default?

@philwebb philwebb changed the title After upgrading to Spring boot 2.5.0 non-embedded database connections use schema/data.sql initialization Non-embedded databases have schema/data.sql scripts applied by default Jun 7, 2021
@philwebb
Copy link
Member

philwebb commented Jun 7, 2021

@everflux That's our current plan, but we've not dug into the details yet.

@wilkinsona wilkinsona self-assigned this Jun 7, 2021
@wilkinsona wilkinsona modified the milestones: 2.5.x, 2.5.1 Jun 8, 2021
wilkinsona added a commit that referenced this issue Jun 8, 2021
The use of the file's absolute path caused test failures on Windows.

See gh-26682
@philwebb philwebb added the status: noteworthy A noteworthy issue to call out in the release notes label Jun 8, 2021
snicoll added a commit that referenced this issue Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: noteworthy A noteworthy issue to call out in the release notes type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

5 participants