Skip to content

yadickson/autodblq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maven Auto Database to Liquibase Generator Plugin

TravisCI Status Codecov Status Central OSSRH Central Maven

Maven plugin to generate xml liquibase files from database

Support

  • DB2
  • Oracle DataBase 11g and 12c (not yet)
  • Basic PostgresSQL (not yet)
  • Basic SQL Server (Tested 2017, Driver jTDS) (not yet)
  • Command line for driver, user, pass and connectionString parameters

DB2

  • TABLES
  • AUTO INCREMENT (always increment and start by 1)
  • DEFAULT VALUES (only string and numeric)
  • INDEX CONSTRAINS
  • UNIQUE CONSTRAINS
  • PRIMARY KEY CONSTRAINS
  • FOREIGN KEY CONSTRAINS (missing onDelete and onUpdate actions yet)
  • VIEWS
  • FUNCTIONS
  • PROCEDURES
  • SEQUENCES (not yet)
  • RESET SEQUENCES (not yet)
  • INSERT DATA TABLES (not yet)
  • TRIGGERS (not yet)
  • Data tables

Dependencies

DB2

<dependency>
    <groupId>com.ibm.db2</groupId>
    <artifactId>jcc</artifactId>
    <version>11.5.0.0</version>
</dependency>

Oracle

<dependency>
    <groupId>com.jslsolucoes</groupId>
    <artifactId>ojdbc6</artifactId>
    <version>11.2.0.1.0</version>
</dependency>

PostgreSQL

<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>42.1.4</version>
</dependency>

SQL Server

<dependency>
    <groupId>net.sourceforge.jtds</groupId>
    <artifactId>jtds</artifactId>
    <version>1.3.1</version>
</dependency>

POM plugin config

<plugin>
    <groupId>com.github.yadickson</groupId>
    <artifactId>autodblq</artifactId>
    <version>...</version>
    <executions>
        <execution>
            <goals>
                <goal>generator</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <driver>...</driver>
        <url>...</url>
        <username>...</username>
        <password>...</password>
        <author>...</author>
        <version>...</version>
        <lqversion>...</lqversion>
        <lqpro>...</lqpro>
        <csvQuotchar>...</csvQuotchar>
        <csvSeparator>...</csvSeparator>
        <tables>
            <param>...</param>
            <param>...</param>
        </tables>
        <views>
            <param>...</param>
            <param>...</param>
        </views>
        <functions>
            <param>...</param>
            <param>...</param>
        </functions>
        <loadData>
            <param>...</param>
            <param>...</param>
        </loadData>
        <sortViews>
            <param>...</param>
            <param>...</param>
        </sortViews>
        <sortFunctions>
            <param>...</param>
            <param>...</param>
        </sortFunctions>
        <excludeTables>
            <param>...</param>
            <param>...</param>
        </excludeTables>
        <excludeViews>
            <param>...</param>
            <param>...</param>
        </excludeViews>
        <excludeFunctions>
            <param>...</param>
            <param>...</param>
        </excludeFunctions>
        <schemas>
            <param>...</param>
            <param>...</param>
        </schemas>
    </configuration>
</plugin>

driver (required)

JDBC Driver class name, examples:

com.ibm.db2.jcc.DB2Driver
oracle.jdbc.driver.OracleDriver
org.postgresql.Driver
net.sourceforge.jtds.jdbc.Driver

url (required)

Database connection string, examples:

jdbc:db2://${host}:${port}/${db}
jdbc:oracle:thin:@${host}:${port}:${db}
jdbc:postgresql://${host}:${port}/${db}
jdbc:jtds:sqlserver://${host}:${port}/${db}

username (required)

Database username

password (required)

Database password

lqversion (optional)

Liquibase version, default 3.6

lqpro (optional)

Liquibase pro license, default false

tables (optional)

Tables to include, example XY.*

views (optional)

Views to include, example VXY.*

functions (optional)

Functions to include, example FXY.*

schemas (optional)

Schemas to include, example MN.*

loadData (optional)

Load data table content, example TXY.*

csvQuotchar (optional, default ')

Csv Quotchar to load data table content

csvSeparator (optional, default ,)

Csv Separator to load data table content

Command line support

<plugin>
    <groupId>com.github.yadickson</groupId>
    <artifactId>autodblq</artifactId>
    <version>...</version>
    <configuration>
        <tables>
            <param>...</param>
            <param>...</param>
        </tables>
    </configuration>
</plugin>
$ mvn autodblq:generator -Dautodblq.driver=... -Dautodblq.url=... -Dautodblq.username=... -Dautodblq.password=...

POM Basic Configuration (include tables)

<plugin>
    <groupId>com.github.yadickson</groupId>
    <artifactId>autodblq</artifactId>
    <version>...</version>
    <executions>
        <execution>
            <goals>
                <goal>generator</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <driver>...</driver>
        <url>...</url>
        <username>...</username>
        <password>...</password>
        <tables>
            <param>...</param>
            <param>...</param>
        </tables>
    </configuration>
</plugin>

POM Basic Configuration (include schemas)

<plugin>
    <groupId>com.github.yadickson</groupId>
    <artifactId>autodblq</artifactId>
    <version>...</version>
    <executions>
        <execution>
            <goals>
                <goal>generator</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <driver>...</driver>
        <url>...</url>
        <username>...</username>
        <password>...</password>
        <schemas>
            <param>...</param>
            <param>...</param>
        </schemas>
    </configuration>
</plugin>