Flyway

Given I have to write the migration scripts myself, what value does Flyway provide?

情到浓时终转凉″ 提交于 2019-12-11 14:43:37
问题 In my situation I use a tool that generates SQL statements to contain all database init/create statements. How does Flyway provide value beyond what my tool provides? Why should I care to write hand-coded migration scripts to use Flyway? 回答1: The question above mixes two things that should be separate: the concept of database creation mixed with the concept of migration. database creation Given a complete database and an empty database, you can use many tools to generate the scripts needed to

Bootstrap EJB3 application before JPA / Hibernate startup

自作多情 提交于 2019-12-11 13:53:50
问题 I have an EJB3 project (EAR packaging of JARs, no WARs) that I'm trying to integrate Flyway (database migrations) into. I've tried a couple of options to create a hook where I can run code before Hibernate starts doing its thing (binding to entities etc); Using the @StartUp annotation. This unfortunately gets run AFTER the JPA startup. ServletContextListener / @WebListener . But of course you need a WEB-INF/ directory for that to work. Looked at using the @DependsOn annotation to see if I

Exception against Oracle DB: “Error while determining database product name: Unsupported feature”

非 Y 不嫁゛ 提交于 2019-12-11 13:15:15
问题 I am attempting to use Flyway 2.0.3 against the following Oracle database: Oracle Database: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 Oracle JDBC Driver: v9.0.2.0.0 When trying to use Flyway through maven (mvn flyway:info -e), I get the error below: Caused by: java.sql.SQLException: Unsupported feature at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at oracle.jdbc.dbaccess.DBError

Ignore SQL file for environments

最后都变了- 提交于 2019-12-11 12:56:01
问题 Can anyone advise if there is a configuration setting for flyway so that it can ignore a certain sql file depending on which environment I am migrating the database in? I am using the maven flyway plugin and have a number of sql files for eg: V1.01_schema.sql V1.02_data.sql V1.03_testdata.sql When I move my database into production I do not want to apply the testData.sql file. Any way that I can get it to ignore this file? 回答1: Yes, you can define a specific profile that will tell flyway

How to use Flyway in Spring Boot with JDBC Security?

六月ゝ 毕业季﹏ 提交于 2019-12-11 12:04:42
问题 I would like to use Flyway as preferred way of database migration handling in my Spring Boot project (using current V1.2.1.RELEASE). This is working fine so far however the integration with Spring Security using a JDBC DataSource seems to override the Flyway mechanism. Following simple scenario: Spring Boot 1.2.1 PostgreSQL 9.4.1 Flyway migration scripts for users, groups and authorities according to Spring Security documentation Problem: The Flyway migration scripts are not executed at

Specifying flywayUrl through system property in SBT

偶尔善良 提交于 2019-12-11 10:47:30
问题 Using Flyway with sbt how can the flywayUrl be specified through system properties ( -D ) instead of via build.sbt ? I want to run the migrations via command line, specifying all parameters (driver, url, user, password) without defining them in build.sbt . The plugin documentation page seems to indicate that this should be possible: Overriding order System properties > Plugin configuration I've tried running it like this: sbt -Dflyway.url=jdbc:h2:file:target/foobar -Dflyway.user=SA

Flyway: Unable to find path for sql migrations

こ雲淡風輕ζ 提交于 2019-12-11 08:43:27
问题 While running flyway migrate I am getting following error: Unable to find path for sql migrations: /path to migration folder/ I am trying to following command: java -cp com.googlecode.flyway.commandline.Main migrate I also added the migration folder in the classpath and specified the baseDir directory. But nothing seems to help. Any help would be greatly appreciated. 回答1: It looks like this is an open bug. I've submitted a question asking for workarounds here, but in the meantime please star

How to Insert CLOB/BLOB data using Flyway?

两盒软妹~` 提交于 2019-12-11 05:38:28
问题 My requirement would be to insert CLOB/BLOB data through insert script using Flyway tool. I could not able to find out anything to achieve this so could any one please guide me how can I achieve this ? 回答1: We have a need to insert XML files (as blobs), and so, have scripts inserting/updating and manipulating blobs in our Oracle Flyway scripts in two ways: One : via a stored procedure migration (ie just PL-SQL in the Flyway *.sql files instead of plain SQL). We use Oracle's utl_raw.cast_to

How can I start flyway migration before hibernate validation?

我只是一个虾纸丫 提交于 2019-12-11 05:27:37
问题 I use flyway + hibernate validate. I have flyway bean: @Component public class DbMigration { private static final Logger LOG = LoggerFactory.getLogger(DbMigration.class); private final Config config; @Autowired public DbMigration(Config config) { this.config = config; } public void runMigration() { try { Flyway flyway = new Flyway(); flyway.configure(properties()); int migrationApplied = flyway.migrate(); LOG.info("[" + migrationApplied + "] migrations are applied"); } catch (FlywayException

Using embedded database with Flyway and jOOQ in Maven for continuous integration

99封情书 提交于 2019-12-11 03:44:26
问题 So I'm really trying to do things 'right' with SQL that will break at compile time using flyway and jOOQ. To do this I need a database solution that can work on the continuous integration server with no access to any server-based database. Ultimately, I want to deploy this to Amazon so I need a solution that is mostly compatible with postgreSQL. HSQLDB's file protocol seems to fit that bill. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema