31 Commits
Author SHA1 Message Date
zeekayandHanzo Dev 85d7501b1f Build on Go 1.27
go fix applied the modernizers. One rewrite it got wrong is corrected here: a
reverse loop over runes became a range over slices.Backward that bound the index
and the value to the SAME name, which does not compile and would have compared a
rune to an index if it had. The value gets its own name.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-17 06:18:28 -07: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
Darius ParvinandGitHub ca21a9d420 Fix typo
change `stamements` to `statements`
2023-04-26 15:09:50 -07:00
Dale Hui f1d65bcf54 go-genproto to google-cloud-go message type migration
Followed these steps: https://github.com/googleapis/google-cloud-go/blob/main/migration.md
2023-03-15 09:13:26 -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
Kyle ChadhaandGitHub 0bb216be40 fix(spanner): upgrade spanner client to latest to support NUMERIC types (#565)
* fix(spanner): upgrade spanner client to latest to support NUMERIC types

* run go mod tidy

* Add spanner example migration test case
2021-05-18 22:16:21 -07:00
Dale Hui 0e9dc0524a Run go fix 2020-10-07 15:31:28 -07:00
Dale Hui 90d5415194 Use spanner cloud emulator to run tests
Addresses: https://github.com/golang-migrate/migrate/issues/410
2020-10-01 17:58:26 -07:00
Dale Hui e43f1f7737 Add local locks for spanner db driver 2020-10-01 17:58:23 -07:00
William Yardley 85e8112d79 fix(spanner): resolve "want scalar type" error
- Update spanner library to cloud.google.com/go/[email protected]
This prevents erroring on DDL statements like:

ALTER TABLE users ALTER COLUMN created
  SET OPTIONS (allow_commit_timestamp = true);
https://github.com/googleapis/google-cloud-go/pull/2656

- Add test case which fails with older version of the library, and
succeeds with this one.

Fixes: #426
2020-08-18 22:35:07 -07:00
William Yardley a7b7869485 docs(spanner): clarify how to set paramters
- include param in DSN example
- link to README docs on param (option) format
- switch to 'parameter' instead of 'option', in the main README, since
this is preferred
2020-08-16 05:40:20 -07:00
Alexandre Thenorio e2c412e011 Add support for comments in Spanner migrations
At the moment GCP Spanner backend does not seem to support comments
(issue being tracked at
https://issuetracker.google.com/issues/159730604).
By adding support for parsing the migration DDL with spansql we are
able to support comments and remove them before applying on the
database
2020-06-30 09:25:33 +02:00
Dale Hui fc9600340b Remove unnecessary byte slice arg from TestMigrate() in database/testing 2020-01-03 00:15:52 -08:00
Jonathan Whitaker 725dc2926b Trim statement leading and trailing whitespace.
The changes herein make sure Spanner DDL statements have leading and
trailing whitespace characters trimmed.
2019-10-03 14:35:37 -06:00
Dale Hui 87ffc99854 Cleanup regex usage in spanner DB driver
- Only compile a regex once for re-use
    - Don't use regex unnecessarily (removing trailing semicolon)
    - Add test for parsing multiple statements in a migration
2019-05-20 08:28:07 -07:00
Kirill MuratovandDale Hui 8afa5fa221 Enabled maligned, staticcheck and errcheck linters (#206)
* Enabled maligned check

* Enabled staticcheck

* Fixes for golint

* Enabled errcheck linter

* Added fixes for error check

* Added errcheck for tests

* Fixed test

* Increased golangci-lint deadline for travis

* Increased golangci-lint deadline for travis

* Decreased golangci-lint deadline for travis

* Revert for backward compatibility

* Using log.Println() instead of fmt.Println()

* Handling os.RemoveAll() errors

* Using t.Error(error) instead of t.Errorf("%v", err)

* Using t.Fatal(error) instead of t.Fatalf("%v", err)

* Using fmt.Sprint(sum) instead of t.Srintf("%v", sum)

* Refactoring

* Revert for backward compatibility

* Revert

* go mod tidy

* Added error logging

* Added error logging

* Added error handling

* Added error handling

* Added error logging

* Fix error logging

* Added error handling

* Fix

* Added logging for migr.Buffer()

* Fixes

* Firebird test disabled

* Fixed nolint comment

* Updated firebird docker image version

* Disabled test for firebird 2.5

* Fixed // nolint
2019-04-26 15:47:16 -07:00
Lukas JoergensenandDale Hui 1cc735c192 postgres: Move lock out of ensureVersionTable, for consistency with other SQL operations (#173)
* Consistently lock in ensureVersionTable and do not call ensureVersionTable from Drop across all database implementations

* Add test for dropping postgres databases

* Fix failing database tests

* Fix CockroachDb test, lock table should be created before versionTable

* Add Initialize() to Driver interface, and add integration tests for Drop() between database implementations and migrate

* Remove Initialize, document breaking behaviour of Drop

* Revert introduction of Initialize method

* Removed Initialize in Stub as well

* Remove call to non-existent Initialize and make sure to close re-initialized database connections

* Revert changes to TestDrop in database/testing

* Split Test and TestMigrate into different test entrypoints

* Remove unused import in migrate_testing

* Remove erroneous code to fix tests

* Add stub source imports to database tests

* Add Stub source to migrate tests

* Use example migrations for tests

* Add file driver to database tests

* Align database directory layout

* Add file source driver to Cassandra

* Review changes

* Minor syntactic change for cleaner diff
2019-02-26 15:56:57 -08:00
Ryo Takashima c92d224df7 Add NewDB to spanner.go 2018-10-28 22:00:05 +09:00
Dale Hui e2a6017efd Use v4 for Go module support 2018-10-10 16:16:23 -07:00
Dale Hui 2b1b184f7f Revert "Remove support for Go modules"
This reverts commit 781565f251.
2018-10-10 16:15:33 -07:00
Dale Hui 781565f251 Remove support for Go modules 2018-10-10 13:34:03 -07:00
Dale Hui 898723524b Fix module support by opting in to modules 2018-09-14 01:14:42 -07:00
Dale Hui 75bf87f76c Update imports to reference fork.
Thanks `make rewrite-import-paths`!
2018-01-19 10:56:55 -08:00
Ashod Ayanyan 9fbbdf4061 Add support for multiple DDL/SQL statements in one migration file 2017-09-18 15:43:46 -07:00
Watanabe MasaruandMatthias Kadenbach bc933ff0db fix spanner ensure migration table 2017-07-09 10:57:10 -07:00
Christian Klotz 375c80e6ae Skip test if SPANNER_DATABASE isn’t set 2017-06-20 17:53:41 +01:00
Christian Klotz 1e90c74175 Add basic Google Spanner test 2017-06-14 19:46:10 +02:00
Christian Klotz 731cf55c7c Add example migrations 2017-06-05 10:50:14 +01:00
Christian Klotz 6637ffd5c9 Provide WithInstance method
Also includes some refactor around package naming, treats own repo as first-class and uses alternative package names for third party imports, Google spanner libraries in this case.
2017-06-04 21:53:33 +01:00
Christian Klotz 6458eee5da Add Spanner driver
Support for Google Cloud Spanner, closes #172. Includes example migrations ported over from the PostgreSQL driver.

In all examples provided by Google I’ve come across, camel-case is used for table names, columns, etc. Hence the examples use this naming convention.
2017-06-04 21:13:49 +01:00