-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add test for Go migrate sample (#2336)
Adds tests and a README for Golang Migrate.
- Loading branch information
Showing
6 changed files
with
261 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Golang Migrate | ||
|
||
This sample application shows how to use [Golang Migrate](https://github.com/golang-migrate/migrate) | ||
with PGAdapter. The sample application automatically starts PGAdapter and the Spanner emulator in a | ||
Docker container and connects to this. It then executes a small set of migration scripts. | ||
|
||
__NOTE__: Golang Migrate only works with PGAdapter if you add `fallback_application_name=golang-migrate` | ||
to the connection string. See [sample.go](./sample.go) for a full example. | ||
|
||
```go | ||
connString := "postgres://localhost:5432/my-database?sslmode=disable&fallback_application_name=golang-migrate" | ||
m, err := migrate.New("file://migrations", connString) | ||
``` | ||
|
||
If you fail to add the application name to the connection string, you will get an error that | ||
the function `pg_advisory_lock` is not supported. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.