Skip to content

Instantly share code, notes, and snippets.

@olned
Last active June 5, 2024 07:04
Show Gist options
  • Save olned/9f95f293277354f6e321b3717bc4e150 to your computer and use it in GitHub Desktop.
Save olned/9f95f293277354f6e321b3717bc4e150 to your computer and use it in GitHub Desktop.
Taskfile golang-migrate docker
version: '3'
tasks:
migrate-up:
dir: "{{.TASKFILE_DIR}}/"
cmds:
- docker run -v ./migrations:/migrations --user $(id -u):$(id -g) --network host migrate/migrate -path /migrations -database ${DATABASE_URL} up
description: "Apply all up migrations"
migrate-down:
dir: "{{.TASKFILE_DIR}}/"
cmds:
- docker run -v ./migrations:/migrations --user $(id -u):$(id -g) --network host migrate/migrate -path /migrations -database ${DATABASE_URL} down
description: "Revert the last migration"
migrate-create:
dir: "{{.TASKFILE_DIR}}/"
cmds:
- docker run -v ./migrations:/migrations --user $(id -u):$(id -g) --network host migrate/migrate create -ext sql -dir /migrations -seq {{.CLI_ARGS}}
description: "Create a new migration file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment