You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: migrator.go
    path of file: ./repos/erda/pkg/database/sqlparser/migrator
    
    the code of the file until where you have to start completion: // Copyright (c) 2021 Terminus, Inc.
//
// Licensed under the Apache License, Version
    
func New(parameters Parameters) (mig *Migrator, err error) {
	if parameters == nil {
		return nil, errors.New("parameters is nil")
	}
	if parameters.MySQLParameters() == nil {
		return nil, errors.New("MySQL DSN is invalid, did you set the right DSN ?")
	}
	if parameters.SandboxParameters() == nil {
		return nil, errors.New("sandbox DSN is invalid, did you set the right DSN ?")
	}

	// init parameters
	mig = new(Migrator)
	mig.Parameters = parameters
	mig.dbSettings = &pygrator.Settings{
		Engine:   pygrator.MySQLConnectorEngine,
		User:     mig.MySQLParameters().Username,
		Password: mig.MySQLParameters().Password,
		Host:     mig.MySQLParameters().Host,
		Port:     mig.MySQLParameters().Port,
		Name:     mig.MySQLParameters().Database,
		TimeZone: pygrator.TimeZoneAsiaShanghai,
	}
	mig.sandboxSettings = &pygrator.Settings{
		Engine:   pygrator.MySQLConnectorEngine,
		User:     mig.SandboxParameters().Username,
		Password: mig.SandboxParameters().Password,
		Host:     mig.SandboxParameters().Host,
		Port:     mig.SandboxParameters().Port,
		Name:     mig.SandboxParameters().Database,
		TimeZone: pygrator.TimeZoneAsiaShanghai,
	}

	// set the SQLs collector filename
	mig.collectorFilename = SQLCollectorFilename()
	if collectDir, ok := mig.Parameters.(SQLCollectorDir); ok {
		mig.collectorFilename = filepath.Join(collectDir.SQLCollectorDir(), mig.collectorFilename)
	}

	// load scripts
	mig.LocalScripts, err = NewScripts(parameters)
	if err != nil {
		return nil, errors.Wrap(err, "failed to NewScripts")
	}

	return mig, nil
}