Merge remote-tracking branch 'origin/master' into automation-branching-ux-updates

This commit is contained in:
Dean 2024-11-08 14:48:25 +00:00
commit 56711de030
3 changed files with 13 additions and 3 deletions

View File

@ -153,7 +153,11 @@ async function createInstance(appId: string, template: AppTemplate) {
await createAllSearchIndex()
if (template && template.useTemplate) {
await sdk.backups.importApp(appId, db, template)
const opts = {
importObjStoreContents: true,
updateAttachmentColumns: !template.key, // preserve attachments when using Budibase templates
}
await sdk.backups.importApp(appId, db, template, opts)
} else {
// create the users table
await db.put(USERS_TABLE_SCHEMA)

View File

@ -123,6 +123,7 @@ export async function updateWithExport(
// don't need obj store, the existing app already has everything we need
await backups.importApp(devId, tempDb, template, {
importObjStoreContents: false,
updateAttachmentColumns: true,
})
const newMetadata = await getNewAppMetadata(tempDb, appDb)
// get the documents to copy

View File

@ -170,7 +170,10 @@ export async function importApp(
appId: string,
db: Database,
template: TemplateType,
opts: { importObjStoreContents: boolean } = { importObjStoreContents: true }
opts: {
importObjStoreContents: boolean
updateAttachmentColumns: boolean
} = { importObjStoreContents: true, updateAttachmentColumns: true }
) {
let prodAppId = dbCore.getProdAppID(appId)
let dbStream: any
@ -219,7 +222,9 @@ export async function importApp(
if (!ok) {
throw "Error loading database dump from template."
}
await updateAttachmentColumns(prodAppId, db)
if (opts.updateAttachmentColumns) {
await updateAttachmentColumns(prodAppId, db)
}
await updateAutomations(prodAppId, db)
// clear up afterward
if (tmpPath) {