Commit Graph

823 Commits

Author SHA1 Message Date
Erik Dubbelboer e5b4be7771 Let database.Open() use schemeFromURL as well (#271)
* Let database.Open() use schemeFromURL as well

Otherwise it will fail on MySQL DSNs.

Moved schemeFromURL into the database package. Also removed databaseSchemeFromURL
and sourceSchemeFromURL as they were just calling schemeFromURL.

Fixes https://github.com/golang-migrate/migrate/pull/265#issuecomment-522301237

* Moved url functions into internal/url

Also merged the test cases.

* Add some database tests to improve coverage

* Fix suggestions
2019-08-20 09:59:15 -07:00
Sebastiaan van Stijn d5960ade4a Docker: restore "from env" behavior, and perform API version negotiation (#270)
* NewDockerContainer: restore "from env" behavior

commit c31948caeb replaced the deprecated
`dockerclient.NewEnvClient` with `dockerclient.NewClientWithOpts`, but
did not add the `FromEnv` option to keep  the old behavior.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

* NewDockerContainer: use API version negotiation

This helps in situations where the daemon is older than
the API client. API version negotiation checks the maximum
supported API version by the daemon, and downgrades to that
API version if needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-20 08:42:07 -07:00
Dale Hui d068374972 Test against MS SQL Server 2019-CTP3.1 (Ubuntu) 2019-08-18 23:37:33 -07:00
Dale Hui 947936279a Update firebird README to reflect lack of official support 2019-08-18 23:34:07 -07:00
Dale Hui 42492c82ca Update golangci-lint from v1.16.0 to v1.17.1 2019-08-17 10:50:42 -07:00
Dale Hui 97cfb4d2a6
Merge pull request #267 from zikaeroh/fix-mongodb-dep
Update MongoDB driver to 1.1.0, use correct import path
2019-08-17 10:20:45 -07:00
zikaeroh d80e0e2f7f Merge branch 'master' into fix-mongodb-dep 2019-08-17 08:13:16 -07:00
Erik Dubbelboer eb7d0dd6a1 Fix in the URL parser with go 1.12.8 and github.com/go-sql-driver/mysql (#265)
* Fix in the URL parser with go 1.12.8 and github.com/go-sql-driver/mysql

Change schemeFromURL to just split the url by :// to find the scheme.
It's not required to parse the whole URL. MySQL DSNs aren't valid URLs.

Fixes #264

* The mysql driver itself also used net/url.Parse

* Also fix TestPasswordUnencodedReservedURLChars

* Keep backwards compatibility with url encoded username and passwords

* Fix suggestions

* Reuse old function names
2019-08-16 23:09:12 -07:00
zikaeroh 9e406c40b5 Update MongoDB driver to 1.1.0, use correct import path 2019-08-14 17:40:52 -07:00
Dale Hui b071731cc2
Merge pull request #258 from mknycha/add-tutorial-for-getting-started
Add getting started docs and Postgres tutorial
2019-08-13 08:31:01 -07:00
Marcin K d3ec78d996 Use different word 2019-08-13 16:40:03 +02:00
Marcin K 98c383cc42 Update info regarding migrations inconsistency 2019-08-13 16:38:16 +02:00
Marcin K 12f7e22e36 Put tutorial specific info into a separate file 2019-08-11 22:06:04 +02:00
Dale Hui 6c7d3123c2
Merge pull request #260 from groyoh/exit_status
Change exit status to 2 on command error
2019-08-10 02:16:59 -07:00
Marcin K 86e4e4965d FAQ: Add question regarding non-Go project usage 2019-08-09 18:50:24 +02:00
Marcin K d0c2e446b7 Remove hint regarding Makefile
As it is too much environment-specific
2019-08-09 18:46:57 +02:00
Marcin K bb1e9dd3ae Describe database transactions 2019-08-09 18:46:04 +02:00
Yohan Robert dc5b8a46c6 Add documentation for exit 2 2019-08-09 15:15:29 +02:00
Marcin K d90f7d51aa Cosmetics 2019-08-08 21:03:54 +02:00
Marcin K d6fa9be6e6 Add a caveat regarding DB lock when running migrations 2019-08-08 21:03:00 +02:00
Marcin K fb4fb978e1 Use idempotent queries 2019-08-08 20:34:21 +02:00
Marcin K 604f1254ba Use sequential migrations naming in example
And add migration conflicts description
2019-08-08 20:11:05 +02:00
Marcin K b49854bde5 TUTORIAL: Use password explicitly 2019-08-07 22:36:20 +02:00
Marcin K fb771c8dd8 Rephrase, list created files 2019-08-07 22:35:22 +02:00
Marcin K 44b07c5f7b Use reverse/down migration instead of rollback 2019-08-07 22:01:04 +02:00
Marcin K e98f9f6a24 FAQ: Remove driver specific info 2019-08-07 21:52:15 +02:00
Yohan Robert 95623b991f Change exit status to 2 on command error
The default exit status when a command cannot be found was 0.
This can cause migrate to fail "silently" in case of typos.
Given that providing an invalid flag causes the program to exit
with a exit status set to 2, the default exit status was also set to 2.
2019-08-07 20:13:16 +02:00
Marcin K 1d402e46a8 Tutorial: Remove info about migration version table 2019-08-07 01:09:26 +02:00
Marcin K d7e0e40e0a FAQ: Add one more question 2019-08-07 01:07:29 +02:00
Marcin K 74b9fdb3cb Add reference to README 2019-08-07 01:01:15 +02:00
Marcin K 01107cb677 Add tutorial file 2019-08-07 01:00:58 +02:00
Dale Hui e93eaeb3fe Another attempt at fixing builds
Addresses: https://github.com/golang-migrate/migrate/issues/254
2019-07-30 00:06:35 -07:00
Dale Hui b55570703d Fix broken builds
Addresses: https://github.com/golang-migrate/migrate/issues/254
2019-07-29 23:59:39 -07:00
Dale Hui fd16003059
Add Go Report Card badge 2019-07-24 22:58:07 -07:00
Dale Hui 71c6afaf98 Reduce docker binary size by stripping symbols 2019-07-12 10:54:42 -07:00
Dale Hui bb99610517 Update Docker image to use Alpine 3.10 2019-07-11 23:22:30 -07:00
Dale Hui ff1977cbd4
Update migration docs
Correct and clarify information around empty migrations
Addresses: https://github.com/golang-migrate/migrate/issues/244
2019-07-11 23:05:33 -07:00
Dale Hui 14a3bcdaa8
Merge pull request #236 from KlotzAndrew/migrate-down-less-destructive
migrate down less destructive
2019-06-26 10:55:06 -07:00
Andrew Klotz ffea024e7c migrate down less destructive
default behaviour for down is to apply all down migrations, which is
comparable to dropping a database - and usually not the desired default
action

proposed changes:

 * `down` prompts for a confirm `y` before applying all down migrations, defaulting to doing nothing
 * `down --all` does the current behaviour, applying all down migrations
 * `down N` is unchanged

 * `down N --all` errors
 * `down --all N` errors
2019-06-26 00:00:54 -04:00
Dale Hui d4e8e9ac07 Deprecate migrate's MultiError in favor of github.com/hashicorp/go-multierror 2019-06-24 08:58:28 -07:00
Dale Hui 5399892051
Merge pull request #240 from k-yomo/fix/typo
Fix typo in README for CLI
2019-06-23 22:08:45 -07:00
k-yomo 8d9d92b7b1 Fix typo in README for CLI 2019-06-23 18:46:05 +09:00
Dale Hui cde3cfc30d Fix broken sqlite tests
Since v4.3.0, Migrate.Drop() no longer recreates the migrate schema version table.
See: https://github.com/golang-migrate/migrate/releases/tag/v4.3.0
2019-06-21 00:15:01 -07:00
Dale Hui 481bf0fb03 Run tests so that coverage profiles don't need to be manually concatenated
Addresses: https://github.com/golang-migrate/migrate/issues/2
2019-06-20 23:07:47 -07:00
Dale Hui 9f6c7e5fc9 Properly clean/normalize user specified directory for create command
Addresses: https://github.com/golang-migrate/migrate/issues/238
2019-06-20 21:35:51 -07:00
Kasparas Galdikas 7c76166697 Github Enterprise support (#234)
* exported Github struct fields and ReadDirectory method

* github ee implementation, tests and docs

* build fixes

* Github Enterprise API endpoint based on docs

* addressing PR comments

* code review

* make linter happy

* parseBool() takes fallback

* pr comments

* tweaks to Config{}
2019-06-16 12:48:01 -07:00
Dale Hui 0d13e794e4 Clean up CLI docs
- Move main CLI docs from cli to cmd/migrate
    - Clean up markdown
    - Update example CLI usage in Docker
2019-06-13 01:30:58 -07:00
Dale Hui 8437fe6dc6
Merge pull request #227 from zhevron/mssql-params
Fix incorrect syntax errors for MSSQL driver
2019-05-27 10:25:36 -07:00
Thomas Lokshall dd0ead011e update Dockerfile referencing renamed mssql driver 2019-05-27 08:20:47 +02:00
Thomas Lokshall ffbd6893f6 sqlserver: update comment referencing mssql 2019-05-27 08:20:35 +02:00