diff --git a/cmd/signozschemamigrator/migrate.go b/cmd/signozschemamigrator/migrate.go index 97322e9d..43363e49 100644 --- a/cmd/signozschemamigrator/migrate.go +++ b/cmd/signozschemamigrator/migrate.go @@ -73,13 +73,7 @@ func main() { // the value of this env would replace all occurences of {{.SIGNOZ_CLUSTER}} in the migration files os.Setenv("SIGNOZ_CLUSTER", clusterName) - managerConfig := migrationmanager.NewConfig( - dsn, - clusterName, - disableDurationSortFeature, - disableTimestampSortFeature, - ) - manager, err := migrationmanager.New(managerConfig) + manager, err := migrationmanager.New(dsn, clusterName, disableDurationSortFeature, disableTimestampSortFeature) if err != nil { logger.Fatal("Failed to create migration manager", zap.Error(err)) } diff --git a/migrationManager/manager.go b/migrationManager/manager.go index 811214b7..38c35ed9 100644 --- a/migrationManager/manager.go +++ b/migrationManager/manager.go @@ -17,40 +17,26 @@ type MigrationManager struct { logger *zap.Logger } -type Config struct { - migrators.MigratorConfig -} - -func NewConfig( - dsn string, - clusterName string, - isDurationSortFeatureDisabled bool, - isTimestampSortFeatureDisabled bool, -) Config { - return Config{ - MigratorConfig: migrators.MigratorConfig{ - DSN: dsn, - ClusterName: clusterName, - IsDurationSortFeatureDisabled: isDurationSortFeatureDisabled, - IsTimestampSortFeatureDisabled: isTimestampSortFeatureDisabled, - }, - } -} - -func New(cfg Config) (*MigrationManager, error) { +func New(dsn string, clusterName string, isDurationSortFeatureDisabled bool, isTimestampSortFeatureDisabled bool) (*MigrationManager, error) { logger := zap.L().With(zap.String("component", "migrationManager")) + cfg := migrators.MigratorConfig{ + DSN: dsn, + ClusterName: clusterName, + IsDurationSortFeatureDisabled: isDurationSortFeatureDisabled, + IsTimestampSortFeatureDisabled: isTimestampSortFeatureDisabled, + } - logsMigrator, err := createNewMigrator("logs", cfg.MigratorConfig) + logsMigrator, err := createNewMigrator("logs", cfg) if err != nil { logger.Error("Failed to create logs migrator", zap.Error(err)) return nil, err } - metricsMigrator, err := createNewMigrator("metrics", cfg.MigratorConfig) + metricsMigrator, err := createNewMigrator("metrics", cfg) if err != nil { logger.Error("Failed to create metrics migrator", zap.Error(err)) return nil, err } - tracesMigrator, err := createNewMigrator("traces", cfg.MigratorConfig) + tracesMigrator, err := createNewMigrator("traces", cfg) if err != nil { logger.Error("Failed to create traces migrator", zap.Error(err)) return nil, err