package main import ( "time" log "github.com/sirupsen/logrus" ) type MigrationJob struct { Schema string Table string PrimaryKey string } var migrationJobs []MigrationJob = []MigrationJob{ { Schema: "Cartografia", Table: "MANZANA", PrimaryKey: "GDB_ARCHIVE_OID", }, { Schema: "Red", Table: "PUERTO", PrimaryKey: "ID_PUERTO", }, } const ( NumExtractors int = 4 NumLoaders int = 8 ChunkSize int = 50000 QueueSize int = 8 ChunksPerBatch int = 16 RowsPerBatch int64 = int64(ChunkSize * ChunksPerBatch) ) func main() { configureLog() startTime := time.Now() log.Info("=== Starting migration ===") log.Infof("Number of loaders: %d, Chunk size: %d", NumLoaders, ChunkSize) sourceDb, targetDb, connError := connectToDatabases() if connError != nil { log.Fatal("Connection error: ", connError) } defer sourceDb.Close() defer targetDb.Close() for _, job := range migrationJobs { log.Infof(">>> Processing job: %s.%s <<<", job.Schema, job.Table) processMigrationJob(sourceDb, targetDb, job) } totalDuration := time.Since(startTime) log.Infof("=== Migration completed successfully! ===") log.Infof("Total migration time: %v", totalDuration) }