Flyway

Is it okay to integrate database migration tools like Flyway, Liquibase with the application code base?

隐身守侯 提交于 2019-12-10 14:14:17
问题 I mean is it good practice to allow application to modify the db? Or should database migration be done externally to the application code base? New to this, so any input will be appreciated. We are using java and gradle to build the application. 回答1: Flyway author here. Yes! At the end of the day, there are two important forces at play: Your schema is really tightly coupled to your application code : Your application expects certain tables and columns to be present so it can read & write to

How to upgrade from flyway 3 directly to flyway 5

可紊 提交于 2019-12-10 13:08:48
问题 Working on a product that is deployed by many clients in many production environments. It includes at least one Spring Boot app. We've used flyway for db schema migrations. Upgrading from Spring Boot 1.5.x to 2.0.x has bumped our flyway version from 3.x to 5.x. The Spring Boot migration guide simply says to upgrade to flyway 4 before the boot upgrade. However, this would require all of our customers to do an intermediate upgrade before being able to upgrade to the latest. So, the question is:

Flyway db migration folder

蓝咒 提交于 2019-12-10 12:49:29
问题 I have a question about flyway migration folder . Does sql's have to reside in project folder Application/foo/bar/main/resources/db/migration. Could it reside outside of the application cource folder? We are using Maven. 回答1: By default Flyway will look for migrations on the classpath under db/migration, which on a Maven project means src/main/resources/db/migration. You can however also use a location starting with the filesystem: prefix that can be anywhere on your disk. See the ”Location

Best strategy to run multiple flyway migration in parallel

感情迁移 提交于 2019-12-10 11:30:53
问题 I want to upgrade multiple schemas on a legacy system running on a single mysql instance. In development I have ~10 schemas, while in production I have ~100 schemas. In development I was using a simple bash loop to start a flyway migrate for each schema: schemas=$(echo "SET SESSION group_concat_max_len=8192; select GROUP_CONCAT(SCHEMA_NAME SEPARATOR ' ') from information_schema.SCHEMATA where SCHEMA_NAME like 'FOO_%'" | mysql -h$DB_URL -P$DB_PORT -u$DB_USER -p$DB_PASSWORD -sN) for schema in

How to use flyway to migrate data from one DB to another DB?

微笑、不失礼 提交于 2019-12-10 10:56:52
问题 I have two postgreSql DB on different server lets say A and B. Can I use flyway some how to copy all data from DB A to B which is newly setup and empty. Its will be helpful if anyone point me to correct direction and tool, requirement is to copy data from one DB to another through some tool automation huge data volume need to consider in solution. 回答1: Flyway doesn't directly support such a capability. However, you could do the following: As Laurenz says, use pg_dump to extract DB A into a

Flyway Spring Boot Autowired Beans with JPA Dependency

六眼飞鱼酱① 提交于 2019-12-10 09:58:55
问题 I am using Flyway 5.0.5 and I am unable to create a java (SpringJdbcMigration) with autowired properties... They end up null . The closest thing I can find is this question: Spring beans are not injected in flyway java based migration The answer mentions it being fixed in Flyway 5 but the links are dead. What am I missing? 回答1: I struggled with this for a long time due to my JPA dependency. I am going to edit the title of my question slightly to reflect this... @Autowired beans are

Flyway concurrent migration

此生再无相见时 提交于 2019-12-10 02:39:43
问题 We are having many projects running on many servers looking up into one database, we"re thinking to setup Flyway to every project for control our database structure. But we are worrying about concurrent migration problem, if some projects re-deploy in sametime.( Off-coures, we always take care the "If exist" things in sql syntax ) How Flyway work when concurrent change on same data table or other struture things ? 回答1: It works as expected. See the answer in the FAQ: http://flywaydb.org

How does flyway sort version numbers?

佐手、 提交于 2019-12-08 15:53:25
问题 If we have migrations like: V1_6__six.sql V1_7__seven.sql V1_8__eight.sql V1_9__nine.sql What should we use for the next version? If we use V1_10 will that come after V1__9 ? Or would we need to prefix the single digit version numbers with a 0 ? Really the question is: are version numbers sorted numerically or alphabetically? 回答1: In one word: numerically. As would be expected for a number. 回答2: For a definitive answer on how the sorting happens, you can refer to the code. This test is

Logging flyway sql with Spring Boot

对着背影说爱祢 提交于 2019-12-08 15:44:41
问题 Is there way to show Flyway migration steps in console, while starting Spring Boot app? Migration is working correctly. I just do not see any log about it. I have checked flyway properties, but there is nothing about it. 回答1: you could add this in your logback.xml file <logger name="org.flywaydb" level="DEBUG"/> or this to only get the sql scripts : <logger name="org.flywaydb.core.internal.dbsupport.SqlScript" level="DEBUG"/> 来源: https://stackoverflow.com/questions/36047610/logging-flyway-sql

Flyway not finding the migrations in a jar file

筅森魡賤 提交于 2019-12-08 04:57:07
问题 I implemented Flyway in a number of applications I support and it worked like a dream. However as soon as I deployed the applications to the test environment the migrations stopped working. After some investigation I found that the migrations are not being located by Flyway when they are loaded into a jar file, but when they are not zipped up (like when I am working in Eclipse or if I extract the jar into the classpath) it works as expected. Due to the plugin architecture of the applications