diff --git a/cmd/go_migrate/process.go b/cmd/go_migrate/process.go index 55691dc..2599d8d 100644 --- a/cmd/go_migrate/process.go +++ b/cmd/go_migrate/process.go @@ -175,16 +175,3 @@ func logColumnTypes(columnTypes []models.ColumnType, label string) { log.Debugf("%+v", col) } } - -func logSampleRow( - schema string, - table string, - columns []ColumnType, - rowValues models.UnknownRowValues, - tag string, -) { - log.Infof("[%s.%s] Sample row: (%s)", schema, table, tag) - for i, col := range columns { - log.Infof("%s (%T): %v", col.Name(), rowValues[i], rowValues[i]) - } -} diff --git a/config.yaml b/config.yaml index 8a47470..92e09df 100644 --- a/config.yaml +++ b/config.yaml @@ -1,4 +1,6 @@ max_parallel_workers: 4 +source_db_type: sqlserver +target_db_type: postgres defaults: max_extractors: 2 diff --git a/internal/app/config/main.go b/internal/app/config/main.go index 43c503c..94e751d 100644 --- a/internal/app/config/main.go +++ b/internal/app/config/main.go @@ -8,10 +8,8 @@ import ( ) type appConfig struct { - SourceDbUrl string - SourceDbType string - TargetDbUrl string - TargetDbType string + SourceDbUrl string + TargetDbUrl string } func loadEnv() { @@ -29,26 +27,14 @@ func getAppConfig() appConfig { log.Fatal("SOURCE_DB_URL environment variable not set") } - sourceDbType := os.Getenv("SOURCE_DB_TYPE") - if sourceDbType == "" { - log.Fatal("SOURCE_DB_TYPE environment variable not set") - } - targetDbUrl := os.Getenv("TARGET_DB_URL") if targetDbUrl == "" { log.Fatal("TARGET_DB_URL environment variable not set") } - targetDbType := os.Getenv("TARGET_DB_TYPE") - if targetDbType == "" { - log.Fatal("TARGET_DB_TYPE environment variable not set") - } - return appConfig{ - SourceDbUrl: sourceDbUrl, - SourceDbType: sourceDbType, - TargetDbUrl: targetDbUrl, - TargetDbType: targetDbType, + SourceDbUrl: sourceDbUrl, + TargetDbUrl: targetDbUrl, } } diff --git a/internal/app/config/migration.go b/internal/app/config/migration.go index 11c5aff..679641e 100644 --- a/internal/app/config/migration.go +++ b/internal/app/config/migration.go @@ -46,12 +46,16 @@ type Job struct { type MigrationConfig struct { MaxParallelWorkers int `yaml:"max_parallel_workers"` + SourceDbType string `yaml:"source_db_type"` + TargetDbType string `yaml:"target_db_type"` Defaults JobConfig `yaml:"defaults"` Jobs []Job `yaml:"jobs"` } type rawConfig struct { MaxParallelWorkers int `yaml:"max_parallel_workers"` + SourceDbType string `yaml:"source_db_type"` + TargetDbType string `yaml:"target_db_type"` Defaults JobConfig `yaml:"defaults"` Jobs []yaml.Node `yaml:"jobs"` }