fix: ci uses a migrated DB template (#2696)

Signed-off-by: Spike Curtis <spike@coder.com>
This commit is contained in:
Spike Curtis 2022-06-28 14:42:19 -07:00 committed by GitHub
parent 576aef40f2
commit cb2d1f488a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -172,7 +172,7 @@ test: test-clean
.PHONY: test
test-postgres: test-clean test-postgres-docker
DB_FROM=$(shell go run scripts/migrate-ci/main.go) gotestsum --junitfile="gotests.xml" --packages="./..." -- \
DB=ci DB_FROM=$(shell go run scripts/migrate-ci/main.go) gotestsum --junitfile="gotests.xml" --packages="./..." -- \
-covermode=atomic -coverprofile="gotests.coverage" -timeout=30m \
-coverpkg=./...,github.com/coder/coder/codersdk \
-count=2 -race -failfast

View File

@ -27,7 +27,14 @@ func main() {
panic(err)
}
err = database.MigrateUp(db)
targetURL := fmt.Sprintf("postgres://postgres:postgres@127.0.0.1:5432/%s?sslmode=disable", dbName)
target, err := sql.Open("postgres", targetURL)
if err != nil {
panic(err)
}
defer target.Close()
err = database.MigrateUp(target)
if err != nil {
panic(err)
}