DATABASE_URL ?= postgres://wherewoof:ww_dev_2026@192.168.20.13:5434/wherewoof
SESSION_SECRET ?= dev-secret-change-me   # dev only — set a real secret in production

export DATABASE_URL
export SESSION_SECRET

.PHONY: db-up seed seed-registry run build generate psql

db-up: ## apply db/schema.sql (embedded migrator, no psql needed)
	cd frontend && go run ./cmd/migrate -schema ../db/schema.sql

seed: ## insert test tag codes TEST000001..TEST000025
	cd frontend && go run ./cmd/seed

seed-registry: ## insert the 100 real preset tag IDs (anti-scam registry)
	cd frontend && go run ./cmd/seed-registry -registry ../db/preset_tag_ids.txt

run: ## run the web server (port 3020)
	cd frontend && go run .

build: ## build linux amd64 binary for .13
	cd frontend && GOOS=linux GOARCH=amd64 go build -o where-woof .

generate: ## regenerate sqlc query code
	cd frontend && PATH="$$PATH:$$(go env GOPATH)/bin" sqlc generate

psql: ## ad-hoc SQL shell into wherewoof-db on .13 (no local psql install)
	ssh sam@192.168.20.13 docker exec -i wherewoof-db psql -U wherewoof -d wherewoof
