|
@@ -24,7 +24,6 @@ import org.cobbzilla.util.system.CommandResult; |
|
|
import org.cobbzilla.util.system.CommandShell; |
|
|
import org.cobbzilla.util.system.CommandShell; |
|
|
import org.cobbzilla.wizard.model.Identifiable; |
|
|
import org.cobbzilla.wizard.model.Identifiable; |
|
|
import org.cobbzilla.wizard.server.config.DatabaseConfiguration; |
|
|
import org.cobbzilla.wizard.server.config.DatabaseConfiguration; |
|
|
import org.flywaydb.core.Flyway; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
@@ -42,6 +41,7 @@ import static org.apache.commons.lang3.RandomStringUtils.randomAlphanumeric; |
|
|
import static org.cobbzilla.util.daemon.ZillaRuntime.*; |
|
|
import static org.cobbzilla.util.daemon.ZillaRuntime.*; |
|
|
import static org.cobbzilla.util.io.FileUtil.abs; |
|
|
import static org.cobbzilla.util.io.FileUtil.abs; |
|
|
import static org.cobbzilla.wizard.server.config.PgRestServerConfiguration.ENV_PGPASSWORD; |
|
|
import static org.cobbzilla.wizard.server.config.PgRestServerConfiguration.ENV_PGPASSWORD; |
|
|
|
|
|
import static org.cobbzilla.wizard.server.listener.FlywayMigrationListener.getFlywayTableName; |
|
|
|
|
|
|
|
|
@Service @Slf4j |
|
|
@Service @Slf4j |
|
|
public class DatabaseFilterService { |
|
|
public class DatabaseFilterService { |
|
@@ -93,7 +93,7 @@ public class DatabaseFilterService { |
|
|
log.info("copyDatabase: dumping flyway schema history data for current database to file: " |
|
|
log.info("copyDatabase: dumping flyway schema history data for current database to file: " |
|
|
+ abs(flywayHistory)); |
|
|
+ abs(flywayHistory)); |
|
|
try (InputStream in = new FileInputStream(configuration.pgDumpDataOnly(flywayHistory, |
|
|
try (InputStream in = new FileInputStream(configuration.pgDumpDataOnly(flywayHistory, |
|
|
Flyway.configure().getTable()))) { |
|
|
|
|
|
|
|
|
getFlywayTableName()))) { |
|
|
log.info("copyDatabase: writing dumped flyway history data to new database " + dbName); |
|
|
log.info("copyDatabase: writing dumped flyway history data to new database " + dbName); |
|
|
final var result = pgExec("psql", dbName, in, null); |
|
|
final var result = pgExec("psql", dbName, in, null); |
|
|
if (!result.isZeroExitStatus()) { |
|
|
if (!result.isZeroExitStatus()) { |
|
|