22 Commits

Author SHA1 Message Date
Lukas Joergensen
480a5a634a 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
Dale Hui
fc2b2e9c64 Use v4 for Go module support 2018-10-10 16:16:23 -07:00
Dale Hui
107db3f407 Revert "Remove support for Go modules"
This reverts commit 5e96539f55495f6fa80240037db6cb1886a99b89.
2018-10-10 16:15:33 -07:00
Dale Hui
5e96539f55 Remove support for Go modules 2018-10-10 13:34:03 -07:00
Dale Hui
16dea48c82 Fix module support by opting in to modules 2018-09-14 01:14:42 -07:00
Kay-Zee
1e4c50b70d
Add sql.DB to Postgres and Mysql structs to allow closing in Close() 2018-09-06 17:16:02 -07:00
Tatsuhito KATO
02c83fb38b more descriptive. 2018-08-15 02:42:18 +00:00
Tatsuhito KATO
9049e49f9e x-tls-cert and x-tls-key must set both. 2018-08-14 07:43:14 +00:00
Tatsuhito KATO
9905791932 Fixes MySQL custom TLS connection failure. 2018-08-13 11:43:19 +00:00
Dale Hui
df658e8fa8 Don't urlencode the username and password for MySQL
Addresses: https://github.com/golang-migrate/migrate/pull/69
2018-07-24 17:56:17 -07:00
Dale Hui
857d7a620d Revert "Merge pull request #69 from bcho/fix/mysql-url-password-encode"
This reverts commit 78d696c1e50611ce975c04781ea07319acaa976a, reversing
changes made to 18583d5a91ec6da5256690faaadef3e850f9d61f.
2018-07-24 17:55:58 -07:00
Chao Deng
48a4062f75 prevent net/url encoding the user password 2018-06-29 21:07:10 +08:00
Reed Allman
094bad431e s/db/conn/ 2018-02-09 15:14:05 -08:00
Reed Allman
a8ef2b8cfe update CI and build tags to go1.9 2018-02-09 00:32:47 -08:00
Reed Allman
636c911d33 fixes mysql lock failure
I believe this closes #297 as well.

I have been working on adding testing of migrations and it requires acquiring
the lock in mysql multiple times to go up and down. After nailing this down to
GET_LOCK returning a failure for every subsequent GET_LOCK call after the
first, I decided it was time to rtfm and lo and behold:

https://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_release-lock

RELEASE_LOCK will not work if called from a different thread than GET_LOCK.
The simplest solution using the golang database/sql pkg appears to be to just
get a single conn to use for every operation. since migrations are happening
sequentially, I don't think this will be a performance hit (possible
improvement). now calling Lock() and Unlock() multiple times will work;
prior to this patch, every call to RELEASE_LOCK would fail. this required
minimal changes to use the *sql.Conn methods instead of the *sql.DB methods.

other changes:

* upped time out to 10s on GET_LOCK, 1s timeout can too easily leave us in a
state where we think we have the lock but it has timed out (during the
operation).
* fixes SetVersion which was not using the tx it was intending to, and fixed a
bug where the transaction could have been left open since Rollback or Commit
may never have been called.

I added a test but it does not seem to come up in the previous patch, at least
easily, I tried some shenanigans. At least, this behavior should be fixed with
this patch and hopefully the test / comment is advisory enough.

thank you for maintaining this library, it has been relatively easy to
integrate with and most stuff works (pg works great :)
2018-02-09 00:27:01 -08:00
Dale Hui
f584949470 Update imports to reference fork.
Thanks `make rewrite-import-paths`!
2018-01-19 10:56:55 -08:00
Fuyuan Bie
bcdbe0f018 Fix parenthesis problem. 2017-05-15 22:01:45 -07:00
Fuyuan Bie
5f2a8b7f30 Use both db name and migration table name for lock hash 2017-05-15 21:50:41 -07:00
Julius Kriukas
14f784961f Fix appending multiStatements=true parameter for mysql driver 2017-04-25 22:54:16 +03:00
Matthias Kadenbach
1f37f41ee8
remove cleanpath, fix mysql ensureVersionTable 2017-03-01 11:48:38 -08:00
Matthias Kadenbach
150ac7d708
add mysql custom TLS config
closes https://github.com/mattes/migrate/pull/117
2017-02-28 16:23:29 -08:00
Matthias Kadenbach
be1ba9204a
add mysql driver, add ENV to docker containers 2017-02-28 15:10:56 -08:00