summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-31 17:38:31 -0600
committermo khan <mo@mokhan.ca>2025-08-01 08:35:02 -0600
commit4ad54d26dd7e7aa337a833950616cf5786dd8977 (patch)
tree57622387fa6bfe3721887cf98210ef1b7d27eff8 /Makefile
parent238b61113456ebad8bad880913dc315cd892a296 (diff)
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.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile9
1 files changed, 8 insertions, 1 deletions
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