I have two .sql
scripts located in resources/db/migration/V1_2022_10_07__setup_schema.sql
respectively resources/db/migration/V1_2022_10_08__insert_data.sql
Now, this is my application.properties
spring.data.jdbc.repositories.enabled=false
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.properties.hibernate.jdbc.batch_size=20
spring.jpa.properties.hibernate.order_updates=true
spring.flyway.baseline-on-migrate=true
spring.flyway.enabled=true
spring.flyway.mixed=true
spring.flyway.default-schema=public
spring.jpa.hibernate.ddl-auto=validate
logging.level.org.springframework.security=DEBUG
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jackson.default-property-inclusion=NON_NULL
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=postgres
spring.datasource.password=pw
And when I run the application, I get the following
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘entityManagerFactory’ defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [address]
When I check in i.e. pgAdmin
, I see that flyway has not created any table. Why?