Skip to content

Commit

Permalink
swap us over to use our fork of sqlboiler-crdb
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeschuurmans committed Jul 23, 2024
1 parent d46f688 commit add3a68
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ DOCKER_IMAGE := "ghcr.io/metal-toolbox/fleetdb"
PROJECT_NAME := fleetdb
REPO := "https://github.com/metal-toolbox/fleetdb.git"
SQLBOILER := v4.15.0
SQLBOILER_DRIVER := v4.0.0

## run all tests
test: | unit-test integration-test
Expand Down Expand Up @@ -73,7 +74,7 @@ dev-database: | vendor
@FLEETDB_CRDB_URI="${DEV_DB}" go run main.go migrate up

## setup test database
test-database: | vendor
test-database: | vendor docker-up
@cockroach sql --insecure -e "drop database if exists fleetdb_test"
@cockroach sql --insecure -e "create database fleetdb_test"
@FLEETDB_CRDB_URI="${TEST_DB}" go run main.go migrate up
Expand All @@ -88,12 +89,11 @@ fresh-test: clean
## install sqlboiler
install-sqlboiler:
go install github.com/volatiletech/sqlboiler/v4@${SQLBOILER}
go install github.com/metal-toolbox/sqlboiler-crdb-fleetdb/v4@${SQLBOILER_DRIVER}

## boil sql
boil: install-sqlboiler
make docker-up
make test-database
sqlboiler crdb --add-soft-deletes
## boil sql, if you get this error (server closed the connection), try again.
boil: install-sqlboiler test-database
sqlboiler crdb-fleetdb --add-soft-deletes

## log into database
psql:
Expand Down
20 changes: 10 additions & 10 deletions internal/models/crdb_main_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sqlboiler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ wipe = true
pkgname = "models"
output = "internal/models"

[crdb]
[crdb-fleetdb]
dbname = "fleetdb_test"
host = "localhost"
port = 26257
Expand Down

0 comments on commit add3a68

Please sign in to comment.