Package org.flywaydb.core.internal.dbsupport

Examples of org.flywaydb.core.internal.dbsupport.DbSupport


        Properties properties = new Properties();
        properties.load(RepeatableFlyway.class.getResourceAsStream("mysql.properties"));
        flyway.configure(properties);

        RepeatableFlyway.configure(flyway, properties);
        DbSupport dbSupport = DbSupportFactory.createDbSupport(flyway.getDataSource().getConnection(), false);
        dbSupport.getCurrentSchema().drop();
        dbSupport.getCurrentSchema().create();
        flyway.init();
    }
View Full Code Here


    {
        try
        {
            // Create a Flyway DbSupport object (based on our connection)
            // This is how Flyway determines the database *type* (e.g. Postgres vs Oracle)
            DbSupport dbSupport = DbSupportFactory.createDbSupport(connection, false);

            // Load our SQL string & execute via Flyway's SQL parser
            SqlScript script = new SqlScript(sqlToExecute, dbSupport);
            script.execute(dbSupport.getJdbcTemplate());
        }
        catch(FlywayException fe)
        {
            // If any FlywayException (Runtime) is thrown, change it to a SQLException
            throw new SQLException("Flyway executeSql() error occurred", fe);
View Full Code Here

                        properties.getProperty("before.user"), properties.getProperty("before.password"), "select * from dual");
                int filesExecuted = runner.execute();
                LOG.info(String.format("executed %d files%n", filesExecuted));
            }

            DbSupport dbSupport = DbSupportFactory.createDbSupport(connection, false);
            if (!dbSupport.getCurrentSchema().getTable(flyway.getTable()).exists()) {
                return;
            }

            String sql = "DELETE FROM " + flyway.getTable()
                + " WHERE " + dbSupport.quote("type") + "='CUSTOM'";
            connection.prepareCall(sql).execute();
        } catch (SQLException e) {
            LOG.error(e.getMessage(), e);
        } catch (IOException e) {
            LOG.error(e.getMessage(), e);
View Full Code Here

    }

    @Override
    public void beforeInfo(Connection connection) {
        try {
            DbSupport dbSupport = DbSupportFactory.createDbSupport(connection, false);
            if (dbSupport.getCurrentSchema().getTable(tmpFlywayTable).exists()) {
                dbSupport.getJdbcTemplate().executeStatement("DROP TABLE " + tmpFlywayTable);
            }
            String sql = "CREATE TABLE " + tmpFlywayTable + " AS SELECT * FROM " + flyway.getTable() +
                    " WHERE " + dbSupport.quote("type") + "='CUSTOM'";
            connection.prepareCall(sql).execute();

            sql = "DELETE FROM " + flyway.getTable()
                    + " WHERE " + dbSupport.quote("type") + "='CUSTOM'";
            connection.prepareCall(sql).execute();
        } catch (SQLException e) {
            LOG.error(e.getMessage(), e);
        }
    }
View Full Code Here

TOP

Related Classes of org.flywaydb.core.internal.dbsupport.DbSupport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.