From 4ad54d26dd7e7aa337a833950616cf5786dd8977 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 31 Jul 2025 17:38:31 -0600 Subject: Load SpiceDB schema into pg This change runs the `spicedb datastore migrate` command against the pg database at startup. It's not a performant solution but it allows for iteration and exploration to understand the challenges with hosting spicedb in postgresql. --- Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index f50bc8d..4425037 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD | sed 's/\//_/g') IMAGE_TAG := $(PROJECT_NAME):$(GIT_BRANCH) AUTHZD_BIN := bin/authzd SPARKLED_BIN := bin/sparkled +SPICEDB := bin/spicedb TOOL := bin/tool ZED := bin/zed @@ -90,4 +91,10 @@ db-init: db-create: db-init @mise exec postgres -- createdb -h /tmp sparkle_development || true -db-setup: db-schema-load db-seed +db-migrate: + @$(TOOL) godotenv -f .env.local,.env -- sh -c '$(SPICEDB) datastore migrate head --datastore-engine postgres --datastore-conn-uri "$$DATABASE_URL" --log-level trace' --skip-release-check + +db-console: + @mise exec postgres -- psql -h /tmp sparkle_development + +db-setup: db-create db-schema-load db-seed -- cgit v1.2.3