refactor: enhance SQL query formatting for PostgreSQL compatibility in dry run and validation processes
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"git.ksdemosapps.com/kylesoda/go-migrate/internal/app/azure"
|
||||
"git.ksdemosapps.com/kylesoda/go-migrate/internal/app/config"
|
||||
dbwrapper "git.ksdemosapps.com/kylesoda/go-migrate/internal/app/db-wrapper"
|
||||
db_dialects "git.ksdemosapps.com/kylesoda/go-migrate/internal/app/db-wrapper/db_dialects"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -67,9 +68,15 @@ func dryRunCountSourceRows(
|
||||
for range maxParallelWorkers {
|
||||
wg.Go(func() {
|
||||
for job := range chJobs {
|
||||
var sourceTableDisplay string
|
||||
if sourceDb.GetDialect() == db_dialects.Postgres {
|
||||
sourceTableDisplay = fmt.Sprintf(`"%s"."%s"`, job.SourceTable.Schema, job.SourceTable.Table)
|
||||
} else {
|
||||
sourceTableDisplay = fmt.Sprintf("[%s].[%s]", job.SourceTable.Schema, job.SourceTable.Table)
|
||||
}
|
||||
res := DryRunResult{
|
||||
JobName: job.Name,
|
||||
SourceTable: fmt.Sprintf("[%s].[%s]", job.SourceTable.Schema, job.SourceTable.Table),
|
||||
SourceTable: sourceTableDisplay,
|
||||
}
|
||||
count, err := countSourceRows(ctx, sourceDb, job)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user