Flyway

Flyway customizing 'version' in naming convention

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 03:25:45
问题 I'm using Flyway 3.2.1. Current properties are set to: flyway.sqlMigrationPrefix=V flyway.sqlMigrationSuffix=.sql flyway.initVersion=0000 flyway.outOfOrder=false According to the documentation, version can be: Dots or underscores separate the parts, you can use as many parts as you like Therefore I came up with this V_201509071234_Filename.sql , even according to examples, my name above should be valid. However when attempting to execute, it complains: Flyway Error: org.flywaydb.core.api

How can I version control Stored Procedures while using flywaydb?

微笑、不失礼 提交于 2019-12-07 23:12:16
问题 I currently have a Java web app which uses a Microsoft SQL Server back end. Database migrations are currently being done manually by sqlcmd which makes use of the :r command to reference script files of our stored procedures and views. This way each stored procedure has his own file "proc_someprocedure.sql" The migration is done by an upgrade script "6.1 upgrade.sql" which refrences the proc file to drop and recreate it in it's current version. We're looking to migrate to flyway and have the

Flyway's support for Groovy-migrations & conditional environment-specific data insertions

寵の児 提交于 2019-12-07 09:48:06
问题 We are working on a Grails-project, and exploring Flyway as a db-migration tool for us. In our current architecture, we rely on Groovy-migration scripts (executed at application-startup) for conditional environment-specific data insertions (say 'some-data' in 'tableA' for Production against 'other-data' in the same table 'tableA' for pre-Production). Q1. Does Flyway support Groovy-migration scripts? Q2. If not, then how best can we achieve conditional environment-specific data insertions? 回答1

Flyway on production database - Migration Checksum mismatch

試著忘記壹切 提交于 2019-12-07 05:25:52
问题 Every time I change something from DB structure I create a new migration file using timestamp to execute in order, with a clean database the migrate command (with maven plugin or command-line tool) it works perfectly, but in a production database, with the same DB structure but with data added I got this error: Failed to execute goal org.flywaydb:flyway-maven-plugin:3.2.1:migrate (main) on project eee-ejb: org.flywaydb.core.api.FlywayException: Validate failed. Migration Checksum mismatch for

Flyway migration hangs for postgres CREATE INDEX CONCURRENTLY

大兔子大兔子 提交于 2019-12-07 01:50:31
问题 I am trying to run a CREATE INDEX CONCURRENTLY command against a Postgres 9.2 database. I implemented a MigrationResolver as shown in issue 655. When this migration step is run via mvn flyway:migrate or similar, the command starts but hangs in waiting mode. I verified that the command is executing via the pg_stat_activity table: test_2015_04_13_110536=# select * from pg_stat_activity; datid | datname | pid | usesysid | usename | application_name | client_addr | client_hostname | client_port |

Flyway not finding my sql migrations in db/migration

孤街浪徒 提交于 2019-12-06 22:29:39
问题 The error: [ERROR] com.googlecode.flyway.core.api.FlywayException: Unable to determine URL for classpath location: db/migration (ClassLoader: ClassRealm[plugin>com.googlecode.flyway:flyway-maven-plugin:2.1.1, parent: sun.misc.Launcher$AppClassLoader@43be2d65]) I followed the quickstart, so I'm not really doing anything complex yet. pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4

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

强颜欢笑 提交于 2019-12-06 15:06:10
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. 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 script file Create a Flyway migration script and copy in the contents of the script file Run the Migrate

Heroku DATABASE_URL as a JDBC Url for Maven

China☆狼群 提交于 2019-12-06 11:04:51
问题 My apps on Heroku use a DATABASE_URL. This is simple to parse with Java into a JDBC URL with a user name and password. There's no issue there. However, I have a JOOQ generator and Flyway migrator that have maven plugins and I can't figure out how to get the JDBC URL, User Name, and Password that these plugins require into maven. So currently I do it on app startup which is not ideal. When my app starts I get the DATABASE_URL, parse it, then do the flyway migration and jOOQ code generation.

How can I version control Stored Procedures while using flywaydb?

♀尐吖头ヾ 提交于 2019-12-06 08:54:26
I currently have a Java web app which uses a Microsoft SQL Server back end. Database migrations are currently being done manually by sqlcmd which makes use of the :r command to reference script files of our stored procedures and views. This way each stored procedure has his own file "proc_someprocedure.sql" The migration is done by an upgrade script "6.1 upgrade.sql" which refrences the proc file to drop and recreate it in it's current version. We're looking to migrate to flyway and have the application migrate it's own database upon deployment. However, I can't find any easy way to maintain a

Best strategy to run multiple flyway migration in parallel

允我心安 提交于 2019-12-06 07:48:52
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 $schemas; do echo "Starting Migration for : $schema" flyway -configFile=src/flyway.conf -user=$DB_USER