package flyway.asdi;

import java.sql.Connection;
import java.util.List;

import org.flywaydb.core.api.migration.jdbc.JdbcMigration;

import fi.nls.oskari.db.BundleHelper;
import fi.nls.oskari.util.FlywayHelper;

public class V1_19_0__remove_asdi_guided_tour implements JdbcMigration {

	private static final String BUNDLE_NAME = "asdi-guided-tour";

	@Override
	public void migrate(Connection connection) throws Exception {

		final List<Long> views = FlywayHelper.getUserAndDefaultViewIds(connection);
		for (Long viewId : views) {
			if (FlywayHelper.viewContainsBundle(connection, BUNDLE_NAME, viewId)) {
				FlywayHelper.removeBundleFromView(connection, BUNDLE_NAME, viewId);
			}

		}
		BundleHelper.unregisterBundle(BUNDLE_NAME, connection);
	}

}

package flyway.asdi;

import java.sql.Connection;
import java.util.List;

import org.flywaydb.core.api.migration.jdbc.JdbcMigration;

import fi.nls.oskari.db.BundleHelper;
import fi.nls.oskari.domain.map.view.Bundle;
import fi.nls.oskari.util.FlywayHelper;

public class V1_19_0__remove_asdi_guided_tour implements JdbcMigration {

	private static final String BUNDLE_NAME = "asdi-guided-tour";

	@Override
	public void migrate(Connection connection) throws Exception {

		Bundle bundle = new Bundle();
		bundle.setName(BUNDLE_NAME);

		final List<Long> views = FlywayHelper.getUserAndDefaultViewIds(connection);
		for (Long viewId : views) {
			if (FlywayHelper.viewContainsBundle(connection, BUNDLE_NAME, viewId)) {
				FlywayHelper.removeBundleFromView(connection, BUNDLE_NAME, viewId);
			}

		}
		BundleHelper.removeBundle(bundle, connection);
	}

}

--- 
+++ 
@@ -6,7 +6,6 @@
 import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
 
 import fi.nls.oskari.db.BundleHelper;
-import fi.nls.oskari.domain.map.view.Bundle;
 import fi.nls.oskari.util.FlywayHelper;
 
 public class V1_19_0__remove_asdi_guided_tour implements JdbcMigration {
@@ -16,9 +15,6 @@
 	@Override
 	public void migrate(Connection connection) throws Exception {
 
-		Bundle bundle = new Bundle();
-		bundle.setName(BUNDLE_NAME);
-
 		final List<Long> views = FlywayHelper.getUserAndDefaultViewIds(connection);
 		for (Long viewId : views) {
 			if (FlywayHelper.viewContainsBundle(connection, BUNDLE_NAME, viewId)) {
@@ -26,7 +22,7 @@
 			}
 
 		}
-		BundleHelper.removeBundle(bundle, connection);
+		BundleHelper.unregisterBundle(BUNDLE_NAME, connection);
 	}
 
 }
Update helper method call to unregister bundle
