Skip to content

Commit

Permalink
fix for timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeschuurmans committed Jul 24, 2024
1 parent add3a68 commit c7ee9b7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,22 @@ docker-down:
docker-clean:
@docker-compose -f quickstart.yml down --volumes

## start if not started, and wait for database to be live
docker-up-and-wait:
@cockroach sql --insecure -e "select 1" || (echo "Attempting to start server . . ." && docker-compose -f quickstart.yml up -d crdb)
@until cockroach sql --insecure -e "select 1" > /dev/null 2>&1; do \
echo "Waiting for cockroach server to be live..."; \
sleep 1; \
done;

## setup devel database
dev-database: | vendor
@cockroach sql --insecure -e "drop database if exists fleetdb"
@cockroach sql --insecure -e "create database fleetdb"
@FLEETDB_CRDB_URI="${DEV_DB}" go run main.go migrate up

## setup test database
test-database: | vendor docker-up
test-database: | vendor docker-up-and-wait
@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 @@ -91,9 +99,9 @@ install-sqlboiler:
go install github.com/volatiletech/sqlboiler/v4@${SQLBOILER}
go install github.com/metal-toolbox/sqlboiler-crdb-fleetdb/v4@${SQLBOILER_DRIVER}

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

## log into database
psql:
Expand Down

0 comments on commit c7ee9b7

Please sign in to comment.