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

Fix failing schema validation for mysql when boolean/enum is used #26759

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ spring:
# modify fetch size as necessary
hibernate.jdbc.fetch_size: 150
hibernate.criteria.literal_handling_mode: BIND
<%_ if (prodDatabaseTypeMysql) { _%>
hibernate.type.preferred_boolean_jdbc_type: TINYINT
<%_ } _%>
<%_ } _%>
hibernate.query.fail_on_pagination_over_collection_fetch: true
hibernate.query.in_clause_parameter_padding: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import org.hibernate.type.SqlTypes;
@JdbcTypeCode(SqlTypes.VARCHAR)
@Column(name = "<%- field.fieldNameAsDatabaseColumn %>", length = 36<% if (field.fieldValidationRequired) { %>, nullable = false<% } %><% if (field.fieldValidationUnique) { %>, unique = true<% } %>)
<%_ } else { _%>
@Column(name = "<%- field.fieldNameAsDatabaseColumn %>"<% if (field.fieldValidate === true) { %><% if (field.fieldValidationMaxLength) { %>, length = <%= field.fieldValidateRulesMaxlength %><% } %><% if (field.fieldValidationRequired) { %>, nullable = false<% } %><% if (field.fieldValidationUnique) { %>, unique = true<% } %><% } %>)
@Column(name = "<%- field.fieldNameAsDatabaseColumn %>"<% if (field.fieldValidate === true) { %><% if (field.fieldValidationMaxLength) { %>, length = <%= field.fieldValidateRulesMaxlength %><% } %><% if (field.fieldValidationRequired) { %>, nullable = false<% } %><% if (field.fieldValidationUnique) { %>, unique = true<% } %><% } %><% if (field.fieldIsEnum && prodDatabaseTypeMysql) { %>, columnDefinition = "VARCHAR(255)"<% } %>)
<%_ } _%>
<&_ } -&>
<%_ } -%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ spring:
jpa:
open-in-view: false
hibernate:
<%_ if (devDatabaseTypeMysql) { _%>
ddl-auto: validate
<%_ } else { _%>
ddl-auto: none
<%_ } _%>
naming:
physical-strategy: org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
Expand All @@ -75,10 +79,17 @@ spring:
hibernate.cache.use_second_level_cache: false
hibernate.cache.use_query_cache: false
hibernate.generate_statistics: false
<%_ if (devDatabaseTypeMysql) { _%>
hibernate.hbm2ddl.auto: validate
<%_ } else { _%>
hibernate.hbm2ddl.auto: none #TODO: temp relief for integration tests, revisit required
<%_ } _%>
hibernate.type.preferred_instant_jdbc_type: TIMESTAMP
hibernate.jdbc.time_zone: UTC
hibernate.timezone.default_storage: NORMALIZE
hibernate.query.fail_on_pagination_over_collection_fetch: true
<%_ if (devDatabaseTypeMysql) { _%>
hibernate.type.preferred_boolean_jdbc_type: TINYINT
<%_ } _%>
<%_ } _%>

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ spring:
jpa:
open-in-view: false
hibernate:
<%_ if (prodDatabaseTypeMysql) { _%>
ddl-auto: validate
<%_ } else { _%>
ddl-auto: none
<%_ } _%>
naming:
physical-strategy: org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
Expand All @@ -63,8 +67,15 @@ spring:
hibernate.cache.use_second_level_cache: false
hibernate.cache.use_query_cache: false
hibernate.generate_statistics: false
<%_ if (prodDatabaseTypeMysql) { _%>
hibernate.hbm2ddl.auto: validate
<%_ } else { _%>
hibernate.hbm2ddl.auto: none #TODO: temp relief for integration tests, revisit required
<%_ } _%>
hibernate.type.preferred_instant_jdbc_type: TIMESTAMP
hibernate.jdbc.time_zone: UTC
hibernate.timezone.default_storage: NORMALIZE
hibernate.query.fail_on_pagination_over_collection_fetch: true
<%_ if (prodDatabaseTypeMysql) { _%>
hibernate.type.preferred_boolean_jdbc_type: TINYINT
<%_ } _%>
Loading