Merge pull request #13900 from Budibase/fix/app-migration-multi-tenancy

Update SQS migration test to not create its own app context
This commit is contained in:
Michael Drury 2024-06-10 14:24:39 +01:00 committed by GitHub
commit 36f315ab8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 8 deletions

View File

@ -1,10 +1,6 @@
import * as setup from "../../../api/routes/tests/utilities"
import { basicTable } from "../../../tests/utilities/structures"
import {
db as dbCore,
SQLITE_DESIGN_DOC_ID,
context,
} from "@budibase/backend-core"
import { db as dbCore, SQLITE_DESIGN_DOC_ID } from "@budibase/backend-core"
import {
LinkDocument,
DocumentType,
@ -16,7 +12,17 @@ import {
generateLinkID,
generateRowID,
} from "../../../db/utils"
import { processMigrations } from "../../migrationsProcessor"
import migration from "../20240604153647_initial_sqs"
import { AppMigration } from "src/appMigrations"
const MIGRATIONS: AppMigration[] = [
{
id: "20240604153647_initial_sqs",
func: migration,
disabled: false,
},
]
const config = setup.getConfig()
let tableId: string
@ -91,9 +97,7 @@ describe("SQS migration", () => {
expect(error.status).toBe(404)
})
await sqsEnabled(async () => {
await context.doInAppContext(config.appId!, async () => {
await migration()
})
await processMigrations(config.appId!, MIGRATIONS)
const designDoc = await db.get<SQLiteDefinition>(SQLITE_DESIGN_DOC_ID)
expect(designDoc.sql.tables).toBeDefined()
const mainTableDef = designDoc.sql.tables[tableId]