From 5493b04d6694b1c33b85ba4dd99088b257597bd9 Mon Sep 17 00:00:00 2001 From: Morgan McCauley Date: Thu, 27 Jul 2023 12:51:25 +1200 Subject: [PATCH] fix: Use correct schema name in is provisioned check (#153) --- indexer-js-queue-handler/provisioner.js | 7 +++++-- indexer-js-queue-handler/scripts/migrate-schema-to-db.js | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/indexer-js-queue-handler/provisioner.js b/indexer-js-queue-handler/provisioner.js index df75e6a6f..78704bcf6 100644 --- a/indexer-js-queue-handler/provisioner.js +++ b/indexer-js-queue-handler/provisioner.js @@ -58,8 +58,11 @@ export default class Provisioner { } async isUserApiProvisioned(accountId, functionName) { - const databaseName = this.replaceSpecialChars(accountId); - const schemaName = this.replaceSpecialChars(functionName); + const sanitizedAccountId = this.replaceSpecialChars(accountId); + const sanitizedFunctionName = this.replaceSpecialChars(functionName); + + const databaseName = sanitizedAccountId; + const schemaName = `${sanitizedAccountId}_${sanitizedFunctionName}`; const sourceExists = await this.hasuraClient.doesSourceExist(databaseName); if (!sourceExists) { diff --git a/indexer-js-queue-handler/scripts/migrate-schema-to-db.js b/indexer-js-queue-handler/scripts/migrate-schema-to-db.js index de5415155..b4b6a787e 100644 --- a/indexer-js-queue-handler/scripts/migrate-schema-to-db.js +++ b/indexer-js-queue-handler/scripts/migrate-schema-to-db.js @@ -1,9 +1,9 @@ -// export HASURA_ENDPOINT='https://queryapi-hasura-graphql-vcqilefdcq-ew.a.run.app' +// export HASURA_ENDPOINT='' // export HASURA_ADMIN_SECRET='' // export PG_ADMIN_USER='hasura' // export PG_ADMIN_PASSWORD='' // export PG_ADMIN_DATABASE='postgres' -// export PG_HOST='' +// export PG_HOST='104.199.4.194' // export PG_PORT=5432 // export CHAIN_ID='mainnet' // export ENV='dev'