WIP: Keep writing projectS

Signed-off-by: Nikolai Rodionov <iam@allanger.xyz>
This commit is contained in:
2026-05-20 13:37:48 +02:00
parent 121e3f2664
commit 0cf8aefc1c
5 changed files with 202 additions and 17 deletions

View File

@@ -61,6 +61,22 @@ tasks:
SOFTPLAYER_DB_CONNECTION_STRING: postgres://softplayer:qwertyu9@localhost:30432/softplayer?sslmode=disable
cmd: go run main.go migrate --migrations-path=file://migrations
force-migration:
desc: Force migrate to a desired version
vars:
SOFTPLAYER_DB_CONNECTION_STRING: postgres://softplayer:qwertyu9@localhost:30432/softplayer?sslmode=disable
cmd: "{{ .MIGRATE }} -path=./migrations -database={{ .SOFTPLAYER_DB_CONNECTION_STRING }} force {{ .CLI_ARGS }}"
deps:
- migrate
drop-migrations:
desc: Drop migrations
vars:
SOFTPLAYER_DB_CONNECTION_STRING: postgres://softplayer:qwertyu9@localhost:30432/softplayer?sslmode=disable
cmd: "{{ .MIGRATE }} -path=./migrations -database={{ .SOFTPLAYER_DB_CONNECTION_STRING }} drop"
deps:
- migrate
run-server-dev:
desc: Run the local dev server
deps:
@@ -113,6 +129,8 @@ tasks:
desc: Add a new database migration
silent: true
cmd: "{{.MIGRATE}} create -dir migrations -ext sql {{.CLI_ARGS}}"
deps:
- migrate
# Install required tools
localbin:
@@ -132,6 +150,7 @@ tasks:
TARGET: "{{.MIGRATE}}"
PACKAGE: github.com/golang-migrate/migrate/v4/cmd/migrate
VERSION: latest
TAGS: "postgres"
go-install-tool:
internal: true
@@ -150,7 +169,13 @@ tasks:
echo "Downloading $PACKAGE"
rm -f "$TARGET"
GOBIN="{{.LOCALBIN}}" go install "$PACKAGE"
TAGS="{{.TAGS}}"
if [ -n "$TAGS" ]; then
echo "Using build tags: $TAGS"
GOBIN="{{.LOCALBIN}}" go install -tags "$TAGS" "$PACKAGE"
else
GOBIN="{{.LOCALBIN}}" go install "$PACKAGE"
fi
mv "{{.LOCALBIN}}/$(basename "$TARGET")" "$VERSIONED"
ln -sf "$(realpath "$VERSIONED")" "$TARGET"