package org.jooq.example.migrator;

import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
import org.jooq.DSLContext;
import org.jooq.SQLDialect;
import org.jooq.impl.DSL;

import java.sql.Connection;

public abstract class JooqMigration implements JdbcMigration {

    @Override
    public final void migrate(Connection connection) throws Exception {
        DSLContext create = DSL.using(connection, SQLDialect.H2);
        migrate(connection, create);
    }

    public abstract void migrate(Connection connection, DSLContext create) throws Exception;
}

@@ -169,16 +169,54 @@
 mpl.DSL;
+%0Aimport org.jooq.tools.jdbc.JDBCUtils;
 %0A%0Aimport
@@ -442,21 +442,39 @@
 on, 
-SQL
+extra
 Dialect
-.H2
+OrThrow(connection)
 );%0A 
@@ -516,16 +516,329 @@
 %0A    %7D%0A%0A
+    private SQLDialect extraDialectOrThrow(Connection connection) %7B%0A        SQLDialect dialect = JDBCUtils.dialect(connection);%0A        if(SQLDialect.DEFAULT.equals(dialect))%0A            throw new IllegalStateException(%22Dialect couldn't be deducted from connection %22 + connection);%0A        return dialect;%0A    %7D%0A%0A
     publ

use JDBCUtils.dialect in JooqMigration