commit | d61efba1e2cfb45c9b97d0183ef5815310feb03a | [log] [tgz] |
---|---|---|
author | Rob Findley <rfindley@google.com> | Wed Apr 03 13:02:59 2019 -0400 |
committer | Julie Qiu <julie@golang.org> | Fri Mar 27 16:46:34 2020 -0400 |
tree | 07098528b80df8a3191dec0b9756b9da78e98653 | |
parent | 58e33497725ab18d9814b5d492006da03ae2bc98 [diff] |
internal/middleware: add a middleware package This adds a simple definition of middleware, along with a single implementation: a Timeout middleware. In a follow-up CL I'll use this to add timeouts to user-facing handlers. Updates b/128689909 Change-Id: Ie2078e4e3da45767c7ef38f1aab25b8da5b1cf14 Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/443949 Reviewed-by: Andrew Bonventre <andybons@google.com>
Migrations are managed with the golang-migrate/migrate CLI tool.
To run all the migrations:
migrate -source file:migrations -database "postgres://localhost:5432/discovery-database?sslmode=disable" up
To create a new migration:
migrate create -ext sql -dir migrations -seq <title>
This creates two empty files in /migrations
:
{version}_{title}.up.sql {version}_{title}.down.sql
The two migration files are used to migrate “up” to the specified version from the previous version, and to migrate “down” to the previous version. See golang-migrate/migrate/MIGRATIONS.md for details.