From 0470dcfb2bf7f6940dbbb1f0033c8e3fe129bdb7 Mon Sep 17 00:00:00 2001
From: Henry Rodman <henry.rodman@gmail.com>
Date: Tue, 10 Dec 2024 06:28:22 -0600
Subject: [PATCH] feat: set search_path to include pgstac for eoapi user (#111)

---
 lib/database/bootstrapper_runtime/handler.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/database/bootstrapper_runtime/handler.py b/lib/database/bootstrapper_runtime/handler.py
index 0db9ae0..7d6595f 100644
--- a/lib/database/bootstrapper_runtime/handler.py
+++ b/lib/database/bootstrapper_runtime/handler.py
@@ -127,6 +127,7 @@ def update_user_permissions(cursor, db_name: str, username: str) -> None:
             "GRANT pgstac_read TO {username};"
             "GRANT pgstac_ingest TO {username};"
             "GRANT pgstac_admin TO {username};"
+            "ALTER USER {username} SET search_path TO pgstac, public;"  # add pgstac to search_path by default
         ).format(
             db_name=sql.Identifier(db_name),
             username=sql.Identifier(username),