Skip to content

Commit cb2d1f4

Browse files
authored
fix: ci uses a migrated DB template (#2696)
Signed-off-by: Spike Curtis <spike@coder.com>
1 parent 576aef4 commit cb2d1f4

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ test: test-clean
172172
.PHONY: test
173173

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

scripts/migrate-ci/main.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@ func main() {
2727
panic(err)
2828
}
2929

30-
err = database.MigrateUp(db)
30+
targetURL := fmt.Sprintf("postgres://postgres:postgres@127.0.0.1:5432/%s?sslmode=disable", dbName)
31+
target, err := sql.Open("postgres", targetURL)
32+
if err != nil {
33+
panic(err)
34+
}
35+
defer target.Close()
36+
37+
err = database.MigrateUp(target)
3138
if err != nil {
3239
panic(err)
3340
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy