diff --git a/lib/DboBuilder/runSQL.ts b/lib/DboBuilder/runSQL.ts index 4ff96f9b..4e620b7a 100644 --- a/lib/DboBuilder/runSQL.ts +++ b/lib/DboBuilder/runSQL.ts @@ -106,13 +106,14 @@ const onSQLResult = async function(this: DboBuilder, queryWithoutRLS: string, { * Fallback for watchSchema in case of not a superuser (cannot add db event listener) */ export const watchSchemaFallback = async function(this: DboBuilder, { queryWithoutRLS, command }: { queryWithoutRLS: string; command: string; }){ - + const SCHEMA_ALTERING_COMMANDS = ["CREATE", "ALTER", "DROP", "REVOKE", "GRANT"]; + const isNotPickedUpByDDLTrigger = ["REVOKE", "GRANT"].includes(command); const { watchSchema, watchSchemaType } = this.prostgles?.opts || {}; if ( watchSchema && - (!this.prostgles.isSuperUser || watchSchemaType === "prostgles_queries") + (!this.prostgles.isSuperUser || watchSchemaType === "prostgles_queries" || isNotPickedUpByDDLTrigger) ) { - if (["CREATE", "ALTER", "DROP", "REVOKE", "GRANT"].includes(command)) { + if (SCHEMA_ALTERING_COMMANDS.includes(command)) { this.prostgles.onSchemaChange({ command, query: queryWithoutRLS }) } else if (queryWithoutRLS) { const cleanedQuery = queryWithoutRLS.toLowerCase().replace(/\s\s+/g, ' '); diff --git a/package-lock.json b/package-lock.json index 006c61b8..a3785311 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "prostgles-server", - "version": "4.2.14", + "version": "4.2.15", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "prostgles-server", - "version": "4.2.14", + "version": "4.2.15", "license": "MIT", "dependencies": { "@types/express": "^4.17.13", diff --git a/package.json b/package.json index 2fd2bde3..8d7c04a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prostgles-server", - "version": "4.2.14", + "version": "4.2.15", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/tests/server/package-lock.json b/tests/server/package-lock.json index b51d7930..10384818 100644 --- a/tests/server/package-lock.json +++ b/tests/server/package-lock.json @@ -21,7 +21,7 @@ }, "../..": { "name": "prostgles-server", - "version": "4.2.14", + "version": "4.2.15", "license": "MIT", "dependencies": { "@types/express": "^4.17.13",