From 10b867c1c3af828d3b4fb8c7f018aaac9aa34258 Mon Sep 17 00:00:00 2001 From: Zane Clark Date: Thu, 31 Oct 2024 09:01:36 -0700 Subject: [PATCH] fix: make ownership grant idempotent --- demo/setup/basics_demo/A__setup_basics_demo.sql | 2 +- demo/setup/citibike_demo/A__setup_citibike_demo.sql | 2 +- demo/setup/citibike_demo_jinja/A__setup_citibike_demo_jinja.sql | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/demo/setup/basics_demo/A__setup_basics_demo.sql b/demo/setup/basics_demo/A__setup_basics_demo.sql index 2d7edf7..d6af411 100644 --- a/demo/setup/basics_demo/A__setup_basics_demo.sql +++ b/demo/setup/basics_demo/A__setup_basics_demo.sql @@ -31,7 +31,7 @@ GRANT DATABASE ROLE IDENTIFIER($SC_W) TO DATABASE ROLE IDENTIFIER($SC_C); CREATE SCHEMA IF NOT EXISTS IDENTIFIER($TARGET_SCHEMA_NAME) WITH MANAGED ACCESS; -- USE SCHEMA INFORMATION_SCHEMA; -- DROP SCHEMA IF EXISTS PUBLIC; -GRANT OWNERSHIP ON SCHEMA IDENTIFIER($TARGET_SCHEMA_NAME) TO ROLE IDENTIFIER($DEPLOY_ROLE); +GRANT OWNERSHIP ON SCHEMA IDENTIFIER($TARGET_SCHEMA_NAME) TO ROLE IDENTIFIER($DEPLOY_ROLE) REVOKE CURRENT GRANTS; USE SCHEMA IDENTIFIER($SCHEMACHANGE_NAMESPACE); -- SCHEMA diff --git a/demo/setup/citibike_demo/A__setup_citibike_demo.sql b/demo/setup/citibike_demo/A__setup_citibike_demo.sql index 2d7edf7..d6af411 100644 --- a/demo/setup/citibike_demo/A__setup_citibike_demo.sql +++ b/demo/setup/citibike_demo/A__setup_citibike_demo.sql @@ -31,7 +31,7 @@ GRANT DATABASE ROLE IDENTIFIER($SC_W) TO DATABASE ROLE IDENTIFIER($SC_C); CREATE SCHEMA IF NOT EXISTS IDENTIFIER($TARGET_SCHEMA_NAME) WITH MANAGED ACCESS; -- USE SCHEMA INFORMATION_SCHEMA; -- DROP SCHEMA IF EXISTS PUBLIC; -GRANT OWNERSHIP ON SCHEMA IDENTIFIER($TARGET_SCHEMA_NAME) TO ROLE IDENTIFIER($DEPLOY_ROLE); +GRANT OWNERSHIP ON SCHEMA IDENTIFIER($TARGET_SCHEMA_NAME) TO ROLE IDENTIFIER($DEPLOY_ROLE) REVOKE CURRENT GRANTS; USE SCHEMA IDENTIFIER($SCHEMACHANGE_NAMESPACE); -- SCHEMA diff --git a/demo/setup/citibike_demo_jinja/A__setup_citibike_demo_jinja.sql b/demo/setup/citibike_demo_jinja/A__setup_citibike_demo_jinja.sql index 2d7edf7..d6af411 100644 --- a/demo/setup/citibike_demo_jinja/A__setup_citibike_demo_jinja.sql +++ b/demo/setup/citibike_demo_jinja/A__setup_citibike_demo_jinja.sql @@ -31,7 +31,7 @@ GRANT DATABASE ROLE IDENTIFIER($SC_W) TO DATABASE ROLE IDENTIFIER($SC_C); CREATE SCHEMA IF NOT EXISTS IDENTIFIER($TARGET_SCHEMA_NAME) WITH MANAGED ACCESS; -- USE SCHEMA INFORMATION_SCHEMA; -- DROP SCHEMA IF EXISTS PUBLIC; -GRANT OWNERSHIP ON SCHEMA IDENTIFIER($TARGET_SCHEMA_NAME) TO ROLE IDENTIFIER($DEPLOY_ROLE); +GRANT OWNERSHIP ON SCHEMA IDENTIFIER($TARGET_SCHEMA_NAME) TO ROLE IDENTIFIER($DEPLOY_ROLE) REVOKE CURRENT GRANTS; USE SCHEMA IDENTIFIER($SCHEMACHANGE_NAMESPACE); -- SCHEMA