feat(server): add production-safe platform-template seed job
A fresh production environment only ran migrations, so the four built-in platform templates were never inserted unless someone manually ran dev-seed (which also writes broad demo data). Extract the platform template upsert into a reusable repository.EnsurePlatformTemplates and add a standalone cmd/seed-platform-templates that calls it. Bake the binary into the migrate image and chain it after migrate up in both docker-compose and the k3s migration job (mounting app config so the binary can dial the right database). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+4
-1
@@ -1,4 +1,4 @@
|
||||
.PHONY: dev-init dev-api dev-worker-generate dev-scheduler dev-ops-api migrate-up migrate-down migrate-monitoring-up migrate-monitoring-down migrate-ops-up migrate-ops-down migrate-create migrate-ops-create sqlc-generate tenant-scope-guard lint test tidy seed
|
||||
.PHONY: dev-init dev-api dev-worker-generate dev-scheduler dev-ops-api migrate-up migrate-down migrate-monitoring-up migrate-monitoring-down migrate-ops-up migrate-ops-down migrate-create migrate-ops-create sqlc-generate tenant-scope-guard lint test tidy seed seed-platform-templates
|
||||
|
||||
DB_URL ?= postgres://geo:geo_dev@localhost:5432/geo?sslmode=disable
|
||||
MONITORING_DB_URL ?= postgres://geo:geo_dev@localhost:5433/geo_monitoring?sslmode=disable
|
||||
@@ -61,6 +61,9 @@ tenant-scope-guard: ## Ensure tenant-scoped SQL includes tenant_id filters
|
||||
seed: ## Insert development seed data
|
||||
go run ./cmd/dev-seed
|
||||
|
||||
seed-platform-templates: ## Insert or update built-in platform templates
|
||||
go run ./cmd/seed-platform-templates
|
||||
|
||||
lint: ## Run linter
|
||||
golangci-lint run ./...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user