Flyway

Unable migrate using Flyway 1.6 in Spring application

一曲冷凌霜 提交于 2019-12-11 03:43:13
问题 I have Roo-generated Spring MVC application connected to PostgreSQL using Hibernate. I am trying to integrate Flyway 1.6 as a bean into Spring application context. "Something prevents" migrations from being executed and I'm getting error on context initialization caused by Hibernate metadata validation. There are no problems performing migrations using Flyway 1.6 Maven plugin (clean, init, migrate). Integration of Flyway 1.5 (previous version) works just fine. What should I do in order to

flyway clean is not dropping scheduler jobs or programs

北战南征 提交于 2019-12-11 03:12:36
问题 I recently added a scheduler job and program to my development schema. When I tried to refresh the schema, I did a flyway clean, and then a flyway migrate. I got the following error: ERROR: Found non-empty schema "TESTDATA" without metadata table! Use init() or set initOnMigrate to true to initialize the metadata table. When I dropped the job and program by hand, I was then able to run migrate again. I've been using flyway for a while, and it's always been very straightforward - but I'm not

Reverse engineering an existing database with flywaydb?

好久不见. 提交于 2019-12-11 02:02:48
问题 can flywaydb support this processing? Setup a reference Oracle database outside of flyway. Create some testdata within this reference database using an application. Reverse engineer this database with flyway. Create test databases during automated builds with flyway based on Scripts gathered through Point 3. I know that 1,2 and 4 are possible. But what's with Point 3? 回答1: No, flyway does only support forward db migrations and no reverse engineering of database. If the database is created

Table not found after apparently successful migration

◇◆丶佛笑我妖孽 提交于 2019-12-11 01:38:12
问题 I was using flyway through the CL to migrate my production DB (mySql), while I was using a fixed SQL query to create the DB, tables, etc. in my unit tests, using H2. I'd like now to better integrate flyway and create/delete DB after each unit test. I have a DB factory and inside its build method I'm using the following code: flyway.setLocations("filesystem:sql/migrations/common","filesystem:sql/migrations/h2"); flyway.setSchemas("MYSERVER"); flyway.setDataSource( p.getProperty(DB_URL.getName(

Flyway logging with Logback

天涯浪子 提交于 2019-12-10 23:53:48
问题 I have a small application configured to use SLF4J + Logback. I'm getting JUL output from Flyway which I'd like Logback to handle. FlywayWrapper.java import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class FlywayWrapper { private static final Logger logger = LoggerFactory.getLogger(FlywayWrapper.class); logback.xml <?xml version="1.0" encoding="UTF-8"?> <configuration> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%date{ISO8601} [%thread

How to execute sql script after db schema generation but before application startup

匆匆过客 提交于 2019-12-10 23:35:14
问题 I want to generate DB structure from my Java classes jpa.generate-ddl: true jpa.ddl-auto: true Also, I need to run SQL script before application will up because I have @PostConstruct methods where I use these data. Can you show an example how to do it in Spring Boot? 回答1: A simple spring boot app with the required functionality can be found at. https://github.com/salilotr89/Spring-boot-postgres-dbinit Spring JDBC has a DataSource initializer feature. Spring Boot enables it by default and

Migration scripts for Structure and Data

不羁岁月 提交于 2019-12-10 22:44:10
问题 Is there a good or recommended tool that manages both DDLs and DMLs migrations? Majority of my App configuration is stored in a database, I want to be able to freely develop and migrate this and not only the DDLs. Any suggestions on this? 回答1: Both Flyway and Liquibase can deal with DML. Speaking from the Flyway perspective, Flyway has been built from the ground up with both DDL and DML (configuration, reference data, ...) in mind. The whole range of DML commands can be used as migrations are

Can't find Flyway maven plugin

爱⌒轻易说出口 提交于 2019-12-10 21:28:02
问题 In my pom.xml, I have: <plugin> <groupId>org.flywaydb</groupId> <artifactId>flyway-maven-plugin</artifactId> <version>3.1</version> <configuration></configuration> </plugin> to test the plugin, I'm doing: mvn flyway:migrate But I get an error: [ERROR] No plugin found for prefix 'flyway' in the current project and in the pl ugin groups [org.wildfly.plugins, org.flywaydb.plugins, org.apache.maven.plugins , org.codehaus.mojo] available from the repositories [local (C:\Users\me\. m2\repository),

Flyway Gradle plugin - Circular dependency

我的梦境 提交于 2019-12-10 21:23:22
问题 I have a project that uses gradle, flyway gradle plugin, mybatis generator and postgres. In my build.gradle, I have: compileJava.dependsOn('myBatisGenerator') I would like to run the flywayMigrate task before myBatisGenerator runs. So I did the following: myBatisGenerator.dependsOn('flywayMigrate') And when I try to run the build using gradle test, I get the following error: FAILURE: Build failed with an exception. * What went wrong: Circular dependency between the following tasks: :classes +

Flyway/Liquibase for Database Structure and DBUnit for Database Inserts?

£可爱£侵袭症+ 提交于 2019-12-10 17:47:18
问题 I have the following scenario for my application: 1 Production Server 1 Test Server n Development Computers For database migration we use Hibernate Schema Update for the Schema and DBUnit for filling in alle the production data (on all servers/computers). When the schema update is done I generate a new DTD File for the new schema, so I can do a fresh import of the DBUnit XML. The application updates the database at startup with the XML file (only on development and test servers/computers!) Of