Commit Graph
23 Commits
Author SHA1 Message Date
e40cf943ca ci: update golangci-lint to v2 (#1341)
* ci: update golangci-lint to v2

update method:
```
golangci-lint migrate
golangci-lint run --fix
```

and fix the last ones manually

* Apply suggestion from @Copilot

* fix tests

---------

Co-authored-by: Hanzo Dev <[email protected]>
2025-12-14 15:14:46 -08:00
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
Roman SharkovandGitHub 34fa67d9f6 Merge pull request #1303 from romshark/master
refactor: Remove go.uber.org/atomic in favor of std sync/atomic
2025-08-20 16:35:25 -07:00
Urban Malc 0876c8cddf Fixed sqlserver not actually getting a lock if lock is already set 2025-04-24 12:14:21 +02:00
Dale Hui 64b02ed2d7 linter fixes 2025-01-26 17:04:55 -08:00
Dale Hui 797848a55c Drop support for Azure SQL Edge
Will be retired on 9/30/2025 and CI tests using the docker image have been flakey
https://azure.microsoft.com/en-us/updates?id=azure-sql-edge-retirement
2025-01-26 16:43:31 -08:00
Dale HuiandGitHub 242d80d406 Fix CI (#1222)
* Run go mod tidy

* Fix Github linting action

Changes:
* checkout before setting up go
* pin golangci-lint version

* Update supported db versions

* Use start-single-node instead of start for cockroachdb
2025-01-26 15:46:11 -08:00
Dale Hui 76d2af2e01 Cleanup sqlserver images after tests run 2024-04-15 22:42:34 -07:00
Alex Kucksdorf 64d58a0983 [sqlserver] Always access version table with explicit schema 2023-12-25 10:29:27 +01:00
Alex Kucksdorf 6e19f77415 [sqlserver] Ensure version table in provided schema
Closes #839
2023-12-25 10:29:26 +01:00
Jon KjennbakkenandGitHub b973232fe8 Switch to microsoft go-mssqldb (#758)
* Switch to https://github.com/microsoft/go-mssqldb

* Fix undeclared name

* rebase

* Merge master
2022-07-27 11:12:27 -07:00
Abhinav Nair baec8ed6b6 Replace deprecated ioutil pkg with os & io
As of Go 1.16, the same functionality is now provided by package io or
package os, and those implementations should be preferred in new code.

So replacing all usage of ioutil pkg with io & os.
2022-06-26 16:57:29 +08:00
Dale Hui 7b4a8df991 Use t.Skipf() per golangci-lint (gosimple) 2022-05-13 15:59:07 -07:00
Josh Holbrook 9f12096659 Run SQL server tests on Azure SQL Edge 2022-03-16 16:50:29 -04:00
dd30be4433 Add SqlServer MSI Support (#591)
* MSI Auth for SQL Server

Add MSI Auth option to SQL Server connection. Default if no password is provided in connection string.

* Parse resource endpoint from server for msi

update host name parsing to get just the resource endpoint for msi

* Update go-mssqldb

update go-mssqldb to resolve panic issue referenced here: https://github.com/denisenkom/go-mssqldb/pull/642

* Update sqlserver.go

switch from deprecated methods. NewServicePrincipalTokenFromManagedIdentity calls the two methods that are deprecated for us

* Update sqlserver.go

add useMsi param instead of looking for nil password

* Update sqlserver readme

Update sqlserver readme for msi auth. make useMsi a bit safer

* Update sqlserver.go

remove comment

* Update database/sqlserver/README.md

Co-authored-by: Keegan Campbell <[email protected]>

* Update sqlserver.go

refactor resource uri logic into its own method

* Update sqlserver_test.go

add tests for msi connection. can only test whether it fails with useMsi= true, or succeeds with useMsi=false

* Update sqlserver.go

check msi.EnsureFresh return value

* Return error for multiple auth and move query filter

move migrate.FilterCustomQuery(purl).String() into one line out of if/else. return error if both useMsi=true and password are passed

* Update README.md

update readme with warning for useMsi

* Update sqlserver_test.go

Update TestMsiFalse test case as now it should fail when useMsi=false and no password is provided

Co-authored-by: Keegan Campbell <[email protected]>
2021-07-01 23:08:44 -07:00
bef0635743 used uber atomic bool instead standard in lock/unlock db (#580)
* used uber atomic bool instead standard in lock/unlock db

* fixing local lock optimization implementation

* fixing mysql local lock optimization implementation

* fixing cockroachdb local lock optimization implementation

* CAS wrapper to automatically restore

* added test for cas with restore

* added atomic lock to sqlite & mongo

* added atomic lock to sqlite & mongo

* fix/refactor test cas restore function

* disable lock for mongo

* mongo local lock before acquiring the db lock

Co-authored-by: a.prinkov <[email protected]>
2021-06-23 14:40:50 -07:00
Dale Hui bdeb9a83fe Correctly mark migrations as dirty when the first down migration fails
Fixes: https://github.com/golang-migrate/migrate/issues/330

Other changes:
  - Cleanup code by using the database.NilVersion constant instead of the magic number -1
2020-04-06 00:07:15 -07:00
Dale Hui fc9600340b Remove unnecessary byte slice arg from TestMigrate() in database/testing 2020-01-03 00:15:52 -08:00
Dale Hui 1cc2ccf044 Fix failing sqlserver tests by using latest images
Don't need to specify Ubuntu in tag since all mcr.microsoft.com/mssql/server images are based on Ubuntu anyways
2019-12-31 17:10:49 -08:00
Dale Hui 30390601c5 Only populate db config values if it's not specified
See also: https://github.com/golang-migrate/migrate/issues/262
2019-10-17 07:48:52 -07:00
Dale Hui 05529b12dc Test against MS SQL Server 2019-CTP3.1 (Ubuntu) 2019-08-18 23:37:33 -07:00
Thomas Lokshall 2320ec99ad sqlserver: update comment referencing mssql 2019-05-27 08:20:35 +02:00
Thomas Lokshall 6a24d9df75 rename mssql driver to sqlserver 2019-05-24 15:16:12 +02:00