2025-01-10 11:12:03 +00:00
|
|
|
---
|
2024-12-06 14:38:42 +00:00
|
|
|
# https://taskfile.dev
|
|
|
|
|
|
2025-03-04 15:51:03 +00:00
|
|
|
version: "3"
|
2024-12-06 14:38:42 +00:00
|
|
|
|
|
|
|
|
vars:
|
2025-03-20 11:06:41 +00:00
|
|
|
MIGRATIONS: "internal/database/migrations"
|
2025-05-05 09:31:21 +00:00
|
|
|
QUERIES: "internal/database/queries/"
|
|
|
|
|
CONFIG_FILE: "sqlc.yml"
|
2024-12-06 14:38:42 +00:00
|
|
|
|
2025-05-03 01:16:53 +00:00
|
|
|
includes:
|
|
|
|
|
compose:
|
2025-05-05 09:31:21 +00:00
|
|
|
dir: ".."
|
2025-05-03 01:16:53 +00:00
|
|
|
taskfile: local-deployments.yml
|
|
|
|
|
internal: true
|
|
|
|
|
|
2024-12-06 14:38:42 +00:00
|
|
|
tasks:
|
|
|
|
|
generate:
|
2025-03-10 11:03:00 +00:00
|
|
|
run: once
|
2024-12-06 14:38:42 +00:00
|
|
|
cmds:
|
2025-05-03 01:16:53 +00:00
|
|
|
- task: compose:up:generate
|
|
|
|
|
- migrate -path {{.MIGRATIONS}} -database {{.DB_URI_GENERATE}} up
|
2025-05-05 09:31:21 +00:00
|
|
|
- sqlc generate --file {{.CONFIG_FILE}}
|
2024-12-06 14:38:42 +00:00
|
|
|
lint:
|
|
|
|
|
cmds:
|
2025-05-03 01:16:53 +00:00
|
|
|
- task: compose:up:generate
|
2025-05-05 09:31:21 +00:00
|
|
|
- sqlc vet --file {{.CONFIG_FILE}}
|
2025-03-17 18:14:15 +00:00
|
|
|
- |
|
|
|
|
|
exit 0
|
2025-05-05 09:31:21 +00:00
|
|
|
for file in {{.MIGRATIONS}}/*.sql; do
|
2025-03-17 18:14:15 +00:00
|
|
|
if [[ -f "$file" ]]; then
|
|
|
|
|
sqlcheck -c -f $file -r 3 # move to 1
|
|
|
|
|
fi
|
|
|
|
|
done
|
2024-12-06 14:38:42 +00:00
|
|
|
mig:create:
|
|
|
|
|
cmds:
|
|
|
|
|
- |
|
|
|
|
|
read -p "Migration Name: " name
|
|
|
|
|
test -z "$name" && echo "Error: Name is required." && exit 1
|
|
|
|
|
migrate create -ext sql -dir {{.MIGRATIONS}} $name
|