From 02c0c49594df7679bd7faf200d4bffcd86027148 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Fri, 18 Feb 2022 17:36:23 +0000 Subject: [PATCH] Deprovision and local couch db url fix --- packages/backend-core/src/context/deprovision.js | 4 ++-- packages/backend-core/src/migrations/index.js | 1 + packages/server/scripts/dev/manage.js | 2 +- packages/server/src/db/client.js | 2 +- packages/worker/scripts/dev/manage.js | 2 +- packages/worker/src/db/index.js | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/backend-core/src/context/deprovision.js b/packages/backend-core/src/context/deprovision.js index 1fbc2c8398..9f89dbbfa9 100644 --- a/packages/backend-core/src/context/deprovision.js +++ b/packages/backend-core/src/context/deprovision.js @@ -1,5 +1,5 @@ const { getGlobalUserParams, getAllApps } = require("../db/utils") -const { getDB, getCouch } = require("../db") +const { getDB } = require("../db") const { getGlobalDB } = require("../tenancy") const { StaticDatabases } = require("../db/constants") @@ -79,7 +79,7 @@ const removeGlobalDB = async tenantId => { const removeTenantApps = async tenantId => { try { - const apps = await getAllApps(getCouch(), { all: true }) + const apps = await getAllApps({ all: true }) const destroyPromises = apps.map(app => getDB(app.appId).destroy()) await Promise.allSettled(destroyPromises) } catch (err) { diff --git a/packages/backend-core/src/migrations/index.js b/packages/backend-core/src/migrations/index.js index e2ed75d407..94ce6c78be 100644 --- a/packages/backend-core/src/migrations/index.js +++ b/packages/backend-core/src/migrations/index.js @@ -22,6 +22,7 @@ exports.getMigrationsDoc = async db => { if (err.status && err.status === 404) { return { _id: DocumentTypes.MIGRATIONS } } + console.error(err) } } diff --git a/packages/server/scripts/dev/manage.js b/packages/server/scripts/dev/manage.js index 77a09a4820..46a221ca33 100644 --- a/packages/server/scripts/dev/manage.js +++ b/packages/server/scripts/dev/manage.js @@ -37,7 +37,7 @@ async function init() { const envFileJson = { PORT: 4001, MINIO_URL: "http://localhost:4004", - COUCH_DB_URL: "http://budibase:budibase@localhost:10000/db/", + COUCH_DB_URL: "http://budibase:budibase@localhost:4005", REDIS_URL: "localhost:6379", WORKER_URL: "http://localhost:4002", INTERNAL_API_KEY: "budibase", diff --git a/packages/server/src/db/client.js b/packages/server/src/db/client.js index 5d0df7ef05..9e90163fff 100644 --- a/packages/server/src/db/client.js +++ b/packages/server/src/db/client.js @@ -5,7 +5,7 @@ const allDbs = require("pouchdb-all-dbs") const find = require("pouchdb-find") const env = require("../environment") -const COUCH_DB_URL = getCouchUrl() || "http://localhost:10000/db/" +const COUCH_DB_URL = getCouchUrl() || "http://localhost:4005" PouchDB.plugin(replicationStream.plugin) PouchDB.plugin(find) diff --git a/packages/worker/scripts/dev/manage.js b/packages/worker/scripts/dev/manage.js index 34a2b7da06..bb7e41ce87 100644 --- a/packages/worker/scripts/dev/manage.js +++ b/packages/worker/scripts/dev/manage.js @@ -16,7 +16,7 @@ async function init() { REDIS_URL: "localhost:6379", REDIS_PASSWORD: "budibase", MINIO_URL: "http://localhost:4004", - COUCH_DB_URL: "http://budibase:budibase@localhost:10000/db/", + COUCH_DB_URL: "http://budibase:budibase@localhost:4005", COUCH_DB_USERNAME: "budibase", COUCH_DB_PASSWORD: "budibase", // empty string is false diff --git a/packages/worker/src/db/index.js b/packages/worker/src/db/index.js index d7e7f5ff4f..770aabd95b 100644 --- a/packages/worker/src/db/index.js +++ b/packages/worker/src/db/index.js @@ -4,7 +4,7 @@ const env = require("../environment") const { getCouchUrl } = require("@budibase/backend-core/db") // level option is purely for testing (development) -const COUCH_DB_URL = getCouchUrl() || "http://localhost:10000/db/" +const COUCH_DB_URL = getCouchUrl() || "http://localhost:4005" let POUCH_DB_DEFAULTS = { prefix: COUCH_DB_URL,