From 7da4fabf51b4b1c421d1098bd59abe144908985a Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Sun, 17 Jul 2022 16:21:55 +0100 Subject: [PATCH 1/2] fixing broken migration --- .../server/src/migrations/functions/userEmailViewCasing.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/src/migrations/functions/userEmailViewCasing.ts b/packages/server/src/migrations/functions/userEmailViewCasing.ts index 16f55655ab..fe58692a27 100644 --- a/packages/server/src/migrations/functions/userEmailViewCasing.ts +++ b/packages/server/src/migrations/functions/userEmailViewCasing.ts @@ -1,4 +1,4 @@ -const { createUserEmailView } = require("@budibase/backend-core/db") +const { createNewUserEmailView } = require("@budibase/backend-core/db") /** * Date: @@ -9,5 +9,5 @@ const { createUserEmailView } = require("@budibase/backend-core/db") */ export const run = async (db: any) => { - await createUserEmailView(db) + await createNewUserEmailView(db) } From 03b951f261c9ba30ad7b2dcce480296abd1f91db Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 18 Jul 2022 10:10:37 +0100 Subject: [PATCH 2/2] Fix for email view casing test. --- .../functions/tests/userEmailViewCasing.spec.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/server/src/migrations/functions/tests/userEmailViewCasing.spec.js b/packages/server/src/migrations/functions/tests/userEmailViewCasing.spec.js index 9db59caa4a..a58f8d9114 100644 --- a/packages/server/src/migrations/functions/tests/userEmailViewCasing.spec.js +++ b/packages/server/src/migrations/functions/tests/userEmailViewCasing.spec.js @@ -4,15 +4,13 @@ const { getGlobalDB, doInTenant } = require("@budibase/backend-core/tenancy") // mock email view creation const coreDb = require("@budibase/backend-core/db") -const createUserEmailView = jest.fn() -coreDb.createUserEmailView = createUserEmailView +const createNewUserEmailView = jest.fn() +coreDb.createNewUserEmailView = createNewUserEmailView const migration = require("../userEmailViewCasing") describe("run", () => { - doInTenant(TENANT_ID, () => { let config = new TestConfig(false) - const globalDb = getGlobalDB() beforeEach(async () => { await config.init() @@ -21,8 +19,10 @@ describe("run", () => { afterAll(config.end) it("runs successfully", async () => { - await migration.run(globalDb) - expect(createUserEmailView).toHaveBeenCalledTimes(1) + await doInTenant(TENANT_ID, async () => { + const globalDb = getGlobalDB() + await migration.run(globalDb) + expect(createNewUserEmailView).toHaveBeenCalledTimes(1) + }) }) - }) })