flyway-extends

Flyway extension of springboot

License

License

Categories

Categories

Flyway Data Databases
GroupId

GroupId

com.fixiu
ArtifactId

ArtifactId

flyway-extends
Last Version

Last Version

0.0.1-RELEASE
Release Date

Release Date

Type

Type

jar
Description

Description

flyway-extends
Flyway extension of springboot
Project URL

Project URL

http://maven.apache.org
Source Code Management

Source Code Management

https://github.com/dongyushuai/flyway-extends

Download flyway-extends

How to add to project

<!-- https://jarcasting.com/artifacts/com.fixiu/flyway-extends/ -->
<dependency>
    <groupId>com.fixiu</groupId>
    <artifactId>flyway-extends</artifactId>
    <version>0.0.1-RELEASE</version>
</dependency>
// https://jarcasting.com/artifacts/com.fixiu/flyway-extends/
implementation 'com.fixiu:flyway-extends:0.0.1-RELEASE'
// https://jarcasting.com/artifacts/com.fixiu/flyway-extends/
implementation ("com.fixiu:flyway-extends:0.0.1-RELEASE")
'com.fixiu:flyway-extends:jar:0.0.1-RELEASE'
<dependency org="com.fixiu" name="flyway-extends" rev="0.0.1-RELEASE">
  <artifact name="flyway-extends" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.fixiu', module='flyway-extends', version='0.0.1-RELEASE')
)
libraryDependencies += "com.fixiu" % "flyway-extends" % "0.0.1-RELEASE"
[com.fixiu/flyway-extends "0.0.1-RELEASE"]

Dependencies

compile (5)

Group / Artifact Type Version
com.github.jsqlparser : jsqlparser jar 4.0
org.springframework.boot : spring-boot-starter-jdbc jar 2.3.9.RELEASE
org.flywaydb : flyway-core jar 6.4.4
org.springframework.boot : spring-boot-configuration-processor jar 2.3.9.RELEASE
org.apache.commons : commons-lang3 jar 3.12.0

Project Modules

There are no modules declared in this project.

What's this?

An extension package of flyway, which supports dynamic column values during data migration

How to use it?

  1. Maven dependence

    <dependency>
    	<groupId>com.fixiu</groupId>
    	<artifactId>flyway-extends</artifactId>
    	<version>0.0.1-RELEASE</version>
    </dependency>
  2. Configure example

    migration:
      column-injection:
        snowflake-id-column:
          add-if-missing: true
          column-index: 0
          column-name: id
          column-type: long
          inject-class: com.fixiu.flyway.injection.SnowflakeIdInjector
    #      inject-value: 1245678987654321
          operations-support:
          - INSERT
          tables:
          - test_1
          - test_2
          - test_3
        date-column:
          add-if-missing: true
          column-name: date_column
          column-type: date
          inject-class: com.fixiu.flyway.injection.CurrentDateInjector
          operations-support:
          - INSERT
          - UPDATE
          tables:
          - test_1
          - test_2
          - test_3
        time-column:
          add-if-missing: true
          column-name: time_column
          column-type: time
          inject-class: com.fixiu.flyway.injection.CurrentTimeInjector
          operations-support:
          - INSERT
          tables:
          - test_1
          - test_2
          - test_3
        date-time-column:
          add-if-missing: true
          column-name: datetime_column
          column-type: timestamp
          inject-class: com.fixiu.flyway.injection.CurrentDatetimeInjector
          operations-support:
          - INSERT
          - UPDATE
          tables:
          - test_1
          - test_2
          - test_3
        normal-column:
          add-if-missing: false
          column-name: name_column
          column-type: string
          inject-value: 'Text here'
          operations-support:
          - INSERT
          - UPDATE
          tables:
          - test_2
          - test_3
  3. Explain

    Property Meaning Values Type
    add-if-missing If there is missing the column, add it true, false Boolean
    column-index The position of a column in SQL, starting with 0, default -1 - Integer
    column-name The name of the column in SQL - String
    column-type Type of column in SQL string
    long
    double
    date
    time
    timestamp
    hex
    null
    com.fixiu.flyway.config.MigrationProperties.ColumnValueType
    inject-class Value injection class, extends from com.fixiu.flyway.injection.AbstractValueInjector com.fixiu.flyway.injection.SnowflakeIdInjector
    com.fixiu.flyway.injection.CurrentDateInjector
    com.fixiu.flyway.injection.CurrentTimeInjector
    com.fixiu.flyway.injection.CurrentDatetimeInjector
    Subclass of com.fixiu.flyway.injection.AbstractValueInjector
    inject-value Injection value - *
    operations-support Supported operation types INSERT
    UPDATE
    List<com.fixiu.flyway.config.MigrationProperties.OperationstType>
    tables Supported table names - List<String>
  4. Extends

    You can extends com.fixiu.flyway.sql.JsqlParserSupport And Implement the supported methods, using “jsqlparser” to realize the transformation of “SQL statement”

Versions

Version
0.0.1-RELEASE