package org.cryptonit.cloud;

import java.sql.Connection;
import java.sql.DriverManager;
import org.flywaydb.core.internal.util.logging.Log;
import org.flywaydb.core.internal.util.logging.LogCreator;
import org.flywaydb.core.internal.util.logging.LogFactory;
import org.slf4j.LoggerFactory;

/**
 * @author Mathias Brossard
 */
public class Database {

    public Database(String url, String user, String password) {
        class ourSlf4jLogCreator implements LogCreator {

            public Log createLogger(Class<?> clazz) {
                org.slf4j.Logger l = LoggerFactory.getLogger(clazz);
                if (l instanceof ch.qos.logback.classic.Logger) {
                    ch.qos.logback.classic.Logger logbackLogger = (ch.qos.logback.classic.Logger) l;
                    logbackLogger.setLevel(ch.qos.logback.classic.Level.INFO);
                }
                return new org.flywaydb.core.internal.util.logging.slf4j.Slf4jLog(l);
            }
        }
        LogFactory.setLogCreator(new ourSlf4jLogCreator());

        Connection c = null;
        try {
            Class.forName("org.postgresql.Driver");
            c = DriverManager.getConnection(url, user, password);
        } catch (Exception e) {
        }
    }
}

@@ -82,16 +82,49 @@
 anager;%0A
+import org.flywaydb.core.Flyway;%0A
 import o
@@ -1257,21 +1257,137 @@
  %7B%0A        %7D
+%0A%0A        Flyway flyway = new Flyway();%0A        flyway.setDataSource(url, user, password);%0A        flyway.migrate();
 %0A    %7D%0A%7D%0A

Initialize and call Flyway