package no.priv.bang.ukelonn.bundle.db.liquibase;

import java.sql.SQLException;
import javax.sql.PooledConnection;

import liquibase.Liquibase;
import liquibase.command.GenerateChangeLogCommand;
import liquibase.database.Database;
import liquibase.database.DatabaseConnection;
import liquibase.database.jvm.JdbcConnection;
import liquibase.diff.compare.CompareControl;
import liquibase.diff.output.DiffOutputControl;
import liquibase.exception.LiquibaseException;
import liquibase.resource.ClassLoaderResourceAccessor;

public class UkelonnLiquibase {

    public void readSchema(PooledConnection connect) {
        try {
            DatabaseConnection databaseConnection = new JdbcConnection(connect.getConnection());
            Liquibase liquibase = new Liquibase(null, null, databaseConnection);
            Database database = liquibase.getDatabase();
            DiffOutputControl diffOutputControl = new DiffOutputControl();
            CompareControl compareControl = new CompareControl();
            GenerateChangeLogCommand command = new GenerateChangeLogCommand();
            command.setReferenceDatabase(database)
                .setOutputStream(System.out)
                .setCompareControl(compareControl);
            command.setDiffOutputControl(diffOutputControl);

            command.execute();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public void createSchema(PooledConnection connect) throws SQLException, LiquibaseException {
        DatabaseConnection databaseConnection = new JdbcConnection(connect.getConnection());
        ClassLoaderResourceAccessor classLoaderResourceAccessor = new ClassLoaderResourceAccessor(getClass().getClassLoader());
        Liquibase liquibase = new Liquibase("db-changelog/db-changelog.xml", classLoaderResourceAccessor, databaseConnection);
        liquibase.update("");
    }

}

@@ -142,95 +142,8 @@
 se;%0A
-import liquibase.command.GenerateChangeLogCommand;%0Aimport liquibase.database.Database;%0A
 impo
@@ -234,102 +234,8 @@
 on;%0A
-import liquibase.diff.compare.CompareControl;%0Aimport liquibase.diff.output.DiffOutputControl;%0A
 impo
@@ -370,865 +370,8 @@
  %7B%0A%0A
-    public void readSchema(PooledConnection connect) %7B%0A        try %7B%0A            DatabaseConnection databaseConnection = new JdbcConnection(connect.getConnection());%0A            Liquibase liquibase = new Liquibase(null, null, databaseConnection);%0A            Database database = liquibase.getDatabase();%0A            DiffOutputControl diffOutputControl = new DiffOutputControl();%0A            CompareControl compareControl = new CompareControl();%0A            GenerateChangeLogCommand command = new GenerateChangeLogCommand();%0A            command.setReferenceDatabase(database)%0A                .setOutputStream(System.out)%0A                .setCompareControl(compareControl);%0A            command.setDiffOutputControl(diffOutputControl);%0A%0A            command.execute();%0A        %7D catch (Exception e) %7B%0A            throw new RuntimeException(e);%0A        %7D%0A    %7D%0A%0A
     

Remove the UkelonnLiquibase.readSchema() method.