40 lines
2.0 KiB
Plaintext
40 lines
2.0 KiB
Plaintext
project_root := justfile_directory()
|
|
backend_dir := project_root + "/Backend"
|
|
common_sh := project_root + "/Commands/Local/scripts/common.sh"
|
|
posix_root := project_root + "/POSIX"
|
|
|
|
# Apply embedded database migrations.
|
|
migrate-up:
|
|
bash -c 'source "{{common_sh}}"; ensure_posix_root "{{project_root}}" "{{posix_root}}"'
|
|
cd '{{backend_dir}}' && go run ./cmd/migrate up
|
|
|
|
# Roll back the most recent embedded database migration (confirmation required).
|
|
migrate-down:
|
|
bash -c 'source "{{common_sh}}"; ensure_posix_root "{{project_root}}" "{{posix_root}}"; confirm_destructive_action "This will roll back the most recent embedded database migration. Continue?"'
|
|
cd '{{backend_dir}}' && go run ./cmd/migrate down
|
|
|
|
# Reset all embedded database migrations (confirmation required).
|
|
migrate-reset:
|
|
bash -c 'source "{{common_sh}}"; ensure_posix_root "{{project_root}}" "{{posix_root}}"; confirm_destructive_action "This will reset all embedded database migrations. Continue?"'
|
|
cd '{{backend_dir}}' && go run ./cmd/migrate reset
|
|
|
|
# Reset embedded database migrations and apply them again from scratch (confirmation required).
|
|
migrate-rebuild:
|
|
bash -c 'source "{{common_sh}}"; ensure_posix_root "{{project_root}}" "{{posix_root}}"; confirm_destructive_action "This will reset all embedded database migrations and reapply them from scratch. Continue?"'
|
|
cd '{{backend_dir}}' && go run ./cmd/migrate reset && go run ./cmd/migrate up
|
|
|
|
# Show the embedded database migration status.
|
|
migrate-status:
|
|
bash -c 'source "{{common_sh}}"; ensure_posix_root "{{project_root}}" "{{posix_root}}"'
|
|
cd '{{backend_dir}}' && go run ./cmd/migrate status
|
|
|
|
# Rebuild the POSIX-to-DB projection from the current POSIX root.
|
|
posix-rebuild:
|
|
bash -c 'source "{{common_sh}}"; ensure_posix_root "{{project_root}}" "{{posix_root}}"'
|
|
cd '{{backend_dir}}' && go run ./cmd/posix rebuild
|
|
|
|
# Format backend Go source files.
|
|
fmt:
|
|
bash -c 'source "{{common_sh}}"; ensure_posix_root "{{project_root}}" "{{posix_root}}"'
|
|
cd '{{backend_dir}}' && gofmt -w ./cmd ./db ./internal
|