-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Closed
Description
When I include the Flyway library in my classpath, Spring Boot correctly locates and executes my migrations. It does not, however, make use of my data.sql script, which I use to import fixture data for unit tests. Per the documentation, I am setting the jpa.hibernate.ddl-auto
property to false
so that Hibernate doesn't try to generate the schema itself. If I remove this property, then Spring boot does load the data.sql file, but Hibernate is also clearly trying to generate the schema redundantly, which is at the very least unnecessary but also probably error prone.
Is there a way to use Flyway along with the normal Spring Boot datasource initialization features?
2015-03-30 16:04:09.851 INFO 56097 --- [ Test worker] o.f.core.internal.util.VersionPrinter : Flyway 3.2.1 by Boxfuse
2015-03-30 16:04:10.113 INFO 56097 --- [ Test worker] o.f.c.i.dbsupport.DbSupportFactory : Database: jdbc:h2:mem:testdb (H2 1.4)
2015-03-30 16:04:10.169 INFO 56097 --- [ Test worker] o.f.core.internal.command.DbValidate : Validated 2 migrations (execution time 00:00.013s)
2015-03-30 16:04:10.183 INFO 56097 --- [ Test worker] o.f.c.i.metadatatable.MetaDataTableImpl : Creating Metadata table: "PUBLIC"."schema_version"
2015-03-30 16:04:10.209 INFO 56097 --- [ Test worker] o.f.core.internal.command.DbMigrate : Current version of schema "PUBLIC": << Empty Schema >>
2015-03-30 16:04:10.209 INFO 56097 --- [ Test worker] o.f.core.internal.command.DbMigrate : Migrating schema "PUBLIC" to version 1 - create user info tables
2015-03-30 16:04:10.242 INFO 56097 --- [ Test worker] o.f.core.internal.command.DbMigrate : Migrating schema "PUBLIC" to version 2 - create recipe tables
2015-03-30 16:04:10.251 INFO 56097 --- [ Test worker] o.f.core.internal.command.DbMigrate : Successfully applied 2 migrations to schema "PUBLIC" (execution time 00:00.070s).
2015-03-30 16:04:10.364 INFO 56097 --- [ Test worker] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2015-03-30 16:04:10.378 INFO 56097 --- [ Test worker] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2015-03-30 16:04:10.490 INFO 56097 --- [ Test worker] org.hibernate.Version : HHH000412: Hibernate Core {4.3.8.Final}
2015-03-30 16:04:10.492 INFO 56097 --- [ Test worker] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2015-03-30 16:04:10.495 INFO 56097 --- [ Test worker] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2015-03-30 16:04:10.795 INFO 56097 --- [ Test worker] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
2015-03-30 16:04:10.853 INFO 56097 --- [ Test worker] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2015-03-30 16:04:10.990 INFO 56097 --- [ Test worker] o.h.h.i.ast.ASTQueryTranslatorFactory : HHH000397: Using ASTQueryTranslatorFactory
2015-03-30 16:04:11.255 INFO 56097 --- [ Test worker] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export
2015-03-30 16:04:11.267 INFO 56097 --- [ Test worker] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete
2015-03-30 16:04:11.348 INFO 56097 --- [ Test worker] o.s.jdbc.datasource.init.ScriptUtils : Executing SQL script from URL [file:/redacted/main/data.sql]
Metadata
Metadata
Assignees
Labels
type: documentationA documentation updateA documentation update