Files
migrate/database/sqlserver
leonklingeleandGitHub 426470006b chore: remove dependency on "hashicorp/go-multierror" (#1322)
* feat: remove dependency on "hashicorp/go-multierror"

It seems the project has been unmainted for quite some time already,
see for example https://github.com/hashicorp/go-multierror/issues/97
and https://github.com/hashicorp/go-multierror/issues/98.
This also removes an uneccessary dependency which slims down the go.mod.

Go as of version 1.20 supports appending errors by specifying
multiple "%w" formatters in the "fmt.Errorf"[^0] function.

[^0]: https://pkg.go.dev/fmt#Errorf

* feat: use errors.Join to combine multiple errors

As an update to the previous commit 59f084ea3be2e7ec9d912c1a311402b1e4c40df6,
use "errors.Join"[^0] instead of multiple "%w" formatters for "fmt.Errorf".

[^0]: https://pkg.go.dev/errors#Join

* chore: bring back unused util.go file as removing it is a breaking change
2025-11-29 11:37:42 -08:00
..
2025-01-26 17:04:55 -08:00

Microsoft SQL Server

sqlserver://username:password@host/instance?param1=value&param2=value sqlserver://username:password@host:port?param1=value&param2=value

URL Query WithInstance Config Description
x-migrations-table MigrationsTable Name of the migrations table
username enter the SQL Server Authentication user id or the Windows Authentication user id in the DOMAIN\User format. On Windows, if user id is empty or missing Single-Sign-On is used.
password The user's password.
host The host to connect to.
port The port to connect to.
instance SQL Server instance name.
database DatabaseName The name of the database to connect to
connection+timeout in seconds (default is 0 for no timeout), set to 0 for no timeout.
dial+timeout in seconds (default is 15), set to 0 for no timeout.
encrypt disable - Data send between client and server is not encrypted. false - Data sent between client and server is not encrypted beyond the login packet (Default). true - Data sent between client and server is encrypted.
app+name The application name (default is go-mssqldb).
useMsi true - Use Azure MSI Authentication for connecting to Sql Server. Must be running from an Azure VM/an instance with MSI enabled. false - Use password authentication (Default). See here for Azure MSI Auth details. NOTE: Since this cannot be tested locally, this is not officially supported.

See https://github.com/microsoft/go-mssqldb for full parameter list.

Driver Support

Which go-mssqldb driver to us?

Please note that the deprecated mssql driver is not supported. Please use the newer sqlserver driver.
See https://github.com/microsoft/go-mssqldb#deprecated for more information.

Official Support by migrate

Versions of MS SQL Server 2019 newer than CTP3.1 are not officially supported since there are issues testing against the Docker image. For more info, see: https://github.com/golang-migrate/migrate/issues/160#issuecomment-522433269