Flyway

Customizing SQL executed per environment

丶灬走出姿态 提交于 2019-12-02 04:28:26
问题 We use flyway to promote our application from dev -> uat -> prod. It would be very useful to use flyway to also deploy the application to developer desktops using a lighter-weight sql database (e.g. Derby or H2). For various reasons Oracle is not a good option for some of our developers. A similar question pointed out a capability in flyway to maintain seperate sets of scripts per target database. I'm reluctant to rely on manual synchronization of two sets of scripts. The SQL difference

Flyway - managing multiple schemas doesn't work

杀马特。学长 韩版系。学妹 提交于 2019-12-02 02:21:50
I'm trying to do a migrate on a number of different Postgresql schemas that have the same lifecycle. According to the flyway documentation such a scenario should work. I have the following in my ANT script: When I run the migration, the changes are only applied to the first (default) schema. Am I doing something wrong, or does the flyway.schemas property only work for clean? Thank you When dealing with multiple schemas, you still have to prefix the object names accordingly. Only the first one in the list is set as the default one for the connection. And yes, you are correct, clean will deal

How do I best work around Flyway issue 156?

♀尐吖头ヾ 提交于 2019-12-02 00:17:59
I'm trying to get Flyway configured and have run up against issue 156 , where I can't escape the following message: [WARNING] Unable to find path for sql migrations: db/migration The folder exists, contains an sql script named V1__baseline.sql and is relative to the path of both the pom.xml and the current working directory when invoking mvn flyway:migrate . The relevant section of my pom.xml looks like this: <plugin> <groupId>com.googlecode.flyway</groupId> <artifactId>flyway-maven-plugin</artifactId> <version>1.5</version> <configuration> <serverId>myServer</serverId> <driver>com.mysql.jdbc

Flyway logging with log4j?

落爺英雄遲暮 提交于 2019-12-01 17:39:29
问题 hy guys, is there a best practice of how to get flyway output into log4j logs? I'm currently running with following log4j.xml: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration> <appender name="CA" class="org.apache.log4j.ConsoleAppender"> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%-p - %m%n"/> </layout> <filter class="org.apache.log4j.varia.LevelRangeFilter"> <param name="levelMin" value=

Flyway Migration with java

若如初见. 提交于 2019-12-01 09:19:48
问题 I learnt flywaydb migration with java works with JDBC connection and also spring support through SpringTemplate, but flyway doesn't work with DAOs. for tables/entities with more relationships,it makes life much easier to do migration with DAO's rather than sql. is there a solution or work-around to deal with this ? 回答1: First, Flyway has its own transaction managing system and does not use Spring transaction handling. If your DAOs extend JdbcDaoSupport , you could instantiate manually the

Flyway: non-empty schema without metadata table

三世轮回 提交于 2019-11-30 17:00:51
Found non-empty schema "public" without metadata table! Use init() or set initOnMigrate to true to initialize the metadata table. I'm using Postgres 9.2 with Postgis 2.0. This means that by default when I create a new database there will be a table created in public schema called spatial_ref_sys . When I run flyway migrate on this database, I get the above error. Running init seems to create the public.schema_version table and mark version 1 as SUCCEDED without actually running the the migration file. I've also tried combinations of initOnMigrate with no success. Flyway is not configured to

Multiple datasources migrations using Flyway in a Spring Boot application

倖福魔咒の 提交于 2019-11-30 11:30:18
We use Flyway for db migration in our Spring Boot based app and now we have a requirement to introduce multi tenancy support while using multiple datasources strategy. As part of that we also need to support migration of multiple data sources. All data sources should maintain the same structure so same migration scripts should be used for migrating of all data sources. Also, migrations should occur upon application startup (as opposed to build time, whereas it seems that the maven plugin can be configured to migrate multiple data sources). What is the best approach to use in order to achieve

Migrating Stored Procedures with Flyway

坚强是说给别人听的谎言 提交于 2019-11-30 09:04:28
How should procedural database code like stored procedures be managed with a database migration tool like Flyway? Unlike DDL I would not want to see changes to a stored procedure stored within multiple database migration files. How can procedural code be managed within a single file under source control, but also take advantage of database migrations with a tool like Flyway? There is no special construct in the framework to deal with this. Mainly because I haven't figured out a way to do this that pleases me. Update: Repeatable scripts are now fully supported as of Flyway 4.0. See https:/

Using Flyway to load data conditionally per environment

走远了吗. 提交于 2019-11-30 08:53:34
Does flyway support conditional execution of a script, per environment? For example, if I have test data, can I create a test data script folder thats only loaded if the env is configured as test? For future visitors, this is a solution for DB specific sql, but applies to data loading too. https://flywaydb.org/documentation/faq#db-specific-sql You can set the flyway.locations=sql/common,sql/data property, and this can be set to different values with spring profiles(dev/test/prod), omitting the sql/data scripts on production. If you are using maven, you can able to achieve it very easily

sprint boot ,maven 项目 flyway 使用

时光怂恿深爱的人放手 提交于 2019-11-30 03:19:11
添加maven 依赖 <dependency> <groupId>org.flywaydb</groupId> <artifactId>flyway-core</artifactId> <version>5.0.3</version> </dependency> <plugin> <groupId>org.flywaydb</groupId> <artifactId>flyway-maven-plugin</artifactId> <version>5.0.3</version> </plugin> 在项目路径下创建 db/migration /db/migration sql 里面是创建数据库建表,加入数据 等 但是提示报错 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flyway' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Bean instantiation via factory method failed; nested