Commit Graph
273 Commits
Author SHA1 Message Date
7968ad00bb Resolves #647 - Fixes typos in Mongo advisory locking parameters (#648)
* Resolves #647 - Fixes typos in Mongo advisory locking parameters

* PR Feedback for #647 - Error out when both params set

* Fixes lint issues with #647

* Additional PR Fixes #647

* Lint fixes again #647

* One more tweak to CONTRIBUTING.md

* One more tweak to CONTRIBUTING.md, again

Co-authored-by: Steve Ramage <[email protected]>
2021-11-04 22:17:35 -07:00
Liu YuanYuanandGitHub f641cf2acf Use the recommended v4 in mysql README 2021-10-24 23:25:52 +08:00
Baumanar ceaadea372 fix test 2021-10-14 10:36:38 +02:00
Florent SoltandBaumanar 95e75e3571 Delete all rows
https://github.com/golang-migrate/migrate/pull/579#discussion_r650178687
2021-10-14 10:36:38 +02:00
Florent SoltandBaumanar f86803e11b Use ParseBool
https://github.com/golang-migrate/migrate/pull/579#discussion_r650171022
2021-10-14 10:36:38 +02:00
Florent SoltandBaumanar 4f4435d786 Support for AWS Keyspaces 2021-10-14 10:36:38 +02:00
Dale Hui 1294fa4cfa Update build constraints
Issue caught by linter

https://pkg.go.dev/go/build#hdr-Build_Constraints
https://pkg.go.dev/cmd/go#hdr-Build_constraints
https://go.googlesource.com/proposal/+/master/design/draft-gobuild.md
2021-09-10 21:04:11 -07:00
Alexandre Perrin 626cfdb74d clickhouse: honor DefaultMigrationsTableEngine when created WithInstance()
Before this patch, clickhouse.WithInstance() would not select
DefaultMigrationsTableEngine when no MigrationsTableEngine was provided
through the clickhouse.Config{} argument. This behaviour forces the
caller to always provide explicitely the config's MigrationsTableEngine.

This patch make it so DefaultMigrationsTableEngine is used when
MigrationsTableEngine is not provided through clickhouse.Config{}.

Signed-off-by: Alexandre Perrin <[email protected]>
2021-09-10 10:44:55 +02:00
Dale HuiandGitHub 8ee1ef4dba Fix grammar for Clickhouse cluster mode docs 2021-08-24 21:45:25 -07:00
5d088745b2 Adding support clickhouse cluster (#568)
* added url query for creating schema_migrations table on cluster

Signed-off-by: Ildar Valiullin <[email protected]>

* changed documentation by clickhouse databases

Signed-off-by: Ildar Valiullin <[email protected]>

Co-authored-by: Dale Hui <[email protected]>
2021-08-24 21:39:30 -07:00
Daniel Gollings 2921f1c3c4 use github.com/cockroachdb/cockroach-go/v2/crdb (for better go module support) 2021-07-14 14:35:05 +02:00
Sébastien CaparrosandGitHub 117e4a15f1 Added a method to create a mysql database from a connection object (#583)
* Added a method to create a mysql database from a connection object

* Calling WithConnection from WithInstance to de-duplicate code

* Adding context and ping to mysql.WithConnection

* Interface type check at compile time
2021-07-06 10:45:43 -07: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
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 20fee1074a Update sqlite and sqlite3 docs with comparison 2021-05-05 10:12:41 -07:00
Andrew GillisandGitHub 4f26ec3bf2 Add support for modernc.org/sqlite (#555)
* Add support for modernc.org/sqlite

This is a CGo-free port of SQLite

* Remove sqlite from build target
2021-05-05 10:04:18 -07:00
Stéphane Klein b10f5e9868 postgres,pgx: fix SchemaName parameter is ignored ##547 2021-04-25 07:34:19 +02:00
Bruno MouraandGitHub f3ea1fb67b clickhouse: make table engine for schema versions table configurable (#551)
* clickhouse: make the table engine used for schema_migrations configurable

* clickhouse: tests creation with configurable table engine

* clickhouse: refactor tests to run with multiple table engines

* clickhouse: clarify the use case for the x-migrations-table-engine option

* clickhouse: fix naming consistency for the migrations table engine

* clickhouse: fix tests function wrap pattern
2021-04-21 22:03:11 -07:00
Stéphane KleinandGitHub 267936eff9 Postgres - add x-migrations-table-quoted url query option (#95) (#533)
* Postgres and pgx - Add x-migrations-table-quoted url query option to postgres and pgx drivers (#95)

By default, gomigrate quote migrations table name, if `x-migrations-table-quoted` is enabled, then you must to quote migrations table name manually, for instance `"gomigrate"."schema_migrations"`

* Work In Progress
2021-04-19 14:57:50 -07:00
Alexey PrinkovandGitHub 485b9d327c added tests for clickhouse database (#532)
* added tests for clickhouse

* added atomic lock flag to clickhouse & remove extra test

* added clickhouse test package
2021-04-05 15:37:50 -07:00
testtest959andGitHub 06029ba265 Postgres: Add a check to determine if table already exists to elide CREATE query (#526)
* Squash commits

* Format

* Minor refactoring

* Address PR feedback; Add mustRun

* Fix a test assert
2021-03-18 21:03:57 -07:00
Dylan BargteilandGitHub 3d4a50190f Add pgx driver package (#517)
* replace lib/pq dependency with pgx in postgres driver

* fix pgx error handling

pgconn is a low-level library, and errors from queries flow through higher-level pgx library

* update postgres tests to use pgx driver and error reporting

* update quoteIdentifier implementation to match lib/pq

* move changes for pgx support into new driver package

* add pgx driver to CLI

* restore examples used in testing for pgx driver

* replace postgres driver name with pgx in DSN in tests and docs

* consolidate connection string formatting in pgx testing

* lock pgx package at v4

Prior to v4, pgx did not support go modules. Version locking the import is the safest way to ensure we get the (as of now) latest version of the module. Additionally v4 implements some breaking changes to connection and error handling, which are also addressed in this commit.

* update parsed URL scheme instead of using string operation

* add pgx for builds using make

* add pgx to top level docs

* remove autogenerated TOC
2021-03-13 21:29:10 -08:00
Dale Hui 15f7a994b2 Use strconv.ParseBool() to parse the x-multi-statement option in the postgres driver 2021-02-03 22:59:24 -08:00
Anatoly RugalevandGitHub 7b3c2cf926 Merge branch 'master' into postgresql-support-multistatement 2021-02-02 13:24:47 +03:00
Anatoly Rugalev f19abe070c Addressed review comments 2021-02-02 11:24:33 +01:00
BenandGitHub 259d067f40 sqlite3: Fix error when path to database contains whitespace (#500) 2021-01-28 23:36:56 -08:00
Anatoly Rugalev 32963ee38f Support multi-statement execution for PostgreSQL 2021-01-18 12:16:37 +03:00
Charles MartinotandGitHub 97dfb0f843 Mysql - Fix crash with ansi_quotes sql_mode enabled (#476)
* Fix crash with ansi_quotes

* Run lint
2020-11-18 12:38:28 -08:00
Maarten BezemerandGitHub dc79a58cfe postgres - Force MigrationsTable in 'public' schema (#414)
* Force MigrationsTable on public schema

* Revert "Force MigrationsTable on public schema"

This reverts commit e5b25e8858ed42d19d420cb8bd16795c060994d2.

* Add example to fix search_path issue

* Use POSTGRESQL_URL in example and fix typo

* Make example simpler by using the `search_path` query parameter of the DB URL
2020-10-15 20:21:00 -07:00
Igor Zibarev 2a7a3a7c7a Check iterator error on Drop where applicable 2020-10-10 23:53:20 +03:00
Dale Hui 0e9dc0524a Run go fix 2020-10-07 15:31:28 -07:00
Dale Hui 9da181d29b Parse out custom TLS params and register the TLS config before calling mysql.ParseDSN
Fixes: https://github.com/golang-migrate/migrate/issues/411
2020-10-06 19:49:59 -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
Andy Newman 0f1c006530 Rename mongo flag for enabling locking. Add validation around parsing mongo params. 2020-09-25 15:02:49 -07:00
Andy Newman 77a2232ae5 Implement PR feedback
rename constants
rename query params
add new timeout interval query param
add new feature flag
use timeout context
2020-09-24 15:38:57 -07:00
Andy Newman b3e3064de1 Add advisory locking to mongodb 2020-09-24 15:38:57 -07:00
Anton Klava d949e6088a mysql - strconv.ParseBool for x-no-lock parame
`strconv.ParseBool` should ensure that if x-no-lock is set to any
non-booleanic value an error is returned. The parameter still
defaults to false.
2020-09-09 11:57:28 +02:00
Anton Klava 2f9c8f3b93 NoLock config option for mysql driver
Skipping `GET_LOCK`/`RELEASE_LOCK` is useful when running MySQL as
multi-master. This change simply disables the locking.

The internal client lock is left in place as a sanity check.
2020-09-08 09:25:42 +02:00
Andreas Linz 86a679f3c6 Link to sqlite3 driver 2020-09-02 20:43:03 +02:00
Andreas Linz 46e1d7758b Add database driver for sqlcipher
This is a copy of the existing sqlite3 driver, except that it imports `_
"github.com/mutecomm/go-sqlcipher/v4"` as database driver.  This allows
to use migrate with encrypted sqlite databases.
2020-09-02 18:29:45 +02: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
Arjan Topolovec 39496bdb0f Allow compilation of neo4j support without CGO.
Since 1.8.0 neo4j driver no longer requires CGO.
2020-07-17 14:07:37 +02:00
Dale Hui d9532b9d38 Use multistmt package to parse multi-statement migrations for clickhouse, cassandra, and neo4j
Addresses: https://github.com/golang-migrate/migrate/issues/406
2020-07-07 23:41:00 -07:00
Dale Hui faf5f8076e Add helper package to parse multi-statement migrations
Addresses: https://github.com/golang-migrate/migrate/issues/406
2020-07-07 22:50:09 -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 HuiandGitHub 5bb4dce471 Add disclaimer to snowflake db driver 2020-06-03 23:16:43 -07:00
Abhinav Kumar 6f1b6f8857 Adding support for schema management in snowflake 2020-06-03 13:55:24 +05:30