Przeglądaj źródła

Copy flyway history on new bubble

pull/13/head
Kristijan Mitrovic 4 lat temu
rodzic
commit
a0dd981747
1 zmienionych plików z 13 dodań i 0 usunięć
  1. +13
    -0
      bubble-server/src/main/java/bubble/service/dbfilter/DatabaseFilterService.java

+ 13
- 0
bubble-server/src/main/java/bubble/service/dbfilter/DatabaseFilterService.java Wyświetl plik

@@ -24,6 +24,7 @@ import org.cobbzilla.util.system.CommandResult;
import org.cobbzilla.util.system.CommandShell;
import org.cobbzilla.wizard.model.Identifiable;
import org.cobbzilla.wizard.server.config.DatabaseConfiguration;
import org.flywaydb.core.Flyway;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@@ -87,6 +88,18 @@ public class DatabaseFilterService {
if (!schemaResult.isZeroExitStatus()) return die("copyDatabase: error populating schema for "+dbName+": "+schemaResult);
}

// Copy full flyway schema history to new database
final var flywayHistory = new File(temp, "flyway.sql");
log.info("copyDatabase: dumping flyway schema history data for current database to file: " + abs(schema));
try (InputStream in = new FileInputStream(configuration.pgDumpDataOnly(flywayHistory,
Flyway.configure().getTable()))) {
log.info("copyDatabase: writing dumped flyway history data to new database " + dbName);
final var result = pgExec("psql", dbName, in, null);
if (!result.isZeroExitStatus()) {
return die("copyDatabase: error populating flyway history data for " + dbName + ": " + result);
}
}

log.info("copyDatabase: copying/filtering data into new database: "+dbName+", "+planApps.size()+" apps enabled") ;
final int port = PortPicker.pickOrDie();



Ładowanie…
Anuluj
Zapisz