prevent attachment column updates when importing budibase templates
This commit is contained in:
parent
f97b10707d
commit
33656a4ae5
|
@ -153,7 +153,11 @@ async function createInstance(appId: string, template: AppTemplate) {
|
||||||
await createAllSearchIndex()
|
await createAllSearchIndex()
|
||||||
|
|
||||||
if (template && template.useTemplate) {
|
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 {
|
} else {
|
||||||
// create the users table
|
// create the users table
|
||||||
await db.put(USERS_TABLE_SCHEMA)
|
await db.put(USERS_TABLE_SCHEMA)
|
||||||
|
|
|
@ -170,7 +170,10 @@ export async function importApp(
|
||||||
appId: string,
|
appId: string,
|
||||||
db: Database,
|
db: Database,
|
||||||
template: TemplateType,
|
template: TemplateType,
|
||||||
opts: { importObjStoreContents: boolean } = { importObjStoreContents: true }
|
opts: {
|
||||||
|
importObjStoreContents: boolean
|
||||||
|
updateAttachmentColumns?: boolean
|
||||||
|
} = { importObjStoreContents: true, updateAttachmentColumns: true }
|
||||||
) {
|
) {
|
||||||
let prodAppId = dbCore.getProdAppID(appId)
|
let prodAppId = dbCore.getProdAppID(appId)
|
||||||
let dbStream: any
|
let dbStream: any
|
||||||
|
@ -219,7 +222,9 @@ export async function importApp(
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
throw "Error loading database dump from template."
|
throw "Error loading database dump from template."
|
||||||
}
|
}
|
||||||
|
if (opts.updateAttachmentColumns) {
|
||||||
await updateAttachmentColumns(prodAppId, db)
|
await updateAttachmentColumns(prodAppId, db)
|
||||||
|
}
|
||||||
await updateAutomations(prodAppId, db)
|
await updateAutomations(prodAppId, db)
|
||||||
// clear up afterward
|
// clear up afterward
|
||||||
if (tmpPath) {
|
if (tmpPath) {
|
||||||
|
|
Loading…
Reference in New Issue