Files
documentdb/pg_documentdb/sql/rbac/extension_admin_setup--0.10-0.sql
T
Zinan Ren 1f110c4fe3 Merged PR 1542804: [OSS] Move type/operator/schema files from pg_helio_api -> pg_documentdb
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactoring
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
Yes
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description

Move type/operator/schema files from pg_helio_api -> pg_documentdb
Except udf files

----
#### AI description  (iteration 1)
#### PR Classification
Code cleanup

#### PR Summary
This pull request moves type, operator, and schema files from the `pg_helio_api` directory to the `pg_documentdb` directory.
- Updated SQL include paths in multiple `pg_helio_api` SQL files to reference `pg_documentdb` directory.
- Modified `pgmongo` SQL files to include paths from `pg_documentdb` instead of `pg_helio_api`.
- Adjusted `validate_helio_extension_state.sh` script to account for new file paths.
- Updated `Makefile` in `pg_helio_api` to include the new directory structure.
- Changed include paths in `pg_documentdb_distributed` and `pg_helio_distributed` C source files to reflect the new directory structure.
2025-01-15 07:48:40 +00:00

26 lines
1.2 KiB
SQL

DO
$do$
BEGIN
/*
* The role is a system-wide object which is not dropped if the extension
* is dropped. Therefore, if helioapi is repeatedly created and dropped,
* a regular CREATE ROLE would fail since __API_ADMIN_ROLE__ still exists.
* We therefore only create the role if it does not exist.
*/
IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = __API_ADMIN_ROLE_STR__) THEN
CREATE ROLE __API_ADMIN_ROLE__;
END IF;
END
$do$;
GRANT SELECT ON TABLE __API_CATALOG_SCHEMA__.collections TO public;
GRANT SELECT ON TABLE __API_CATALOG_SCHEMA__.collection_indexes TO public;
GRANT USAGE ON SCHEMA __API_CATALOG_SCHEMA__ TO __API_ADMIN_ROLE__;
GRANT USAGE ON SCHEMA __API_SCHEMA_INTERNAL__ TO __API_ADMIN_ROLE__;
GRANT USAGE ON SCHEMA __API_SCHEMA__ TO __API_ADMIN_ROLE__;
GRANT USAGE ON SCHEMA public TO __API_ADMIN_ROLE__;
GRANT ALL ON SCHEMA __API_DATA_SCHEMA__ TO __API_ADMIN_ROLE__;
GRANT ALL ON TABLE __API_CATALOG_SCHEMA__.collections TO __API_ADMIN_ROLE__;
GRANT ALL ON TABLE __API_CATALOG_SCHEMA__.collection_indexes TO __API_ADMIN_ROLE__;
GRANT ALL ON SEQUENCE __API_CATALOG_SCHEMA__.collections_collection_id_seq TO __API_ADMIN_ROLE__;
GRANT ALL ON SEQUENCE __API_CATALOG_SCHEMA__.collection_indexes_index_id_seq TO __API_ADMIN_ROLE__;