Updating export template script to remove users as well.

This commit is contained in:
mike12345567 2021-06-08 18:09:09 +01:00
parent 72c3ff8c2e
commit 033258b495
1 changed files with 11 additions and 1 deletions

View File

@ -5,6 +5,10 @@ const { join } = require("path")
const CouchDB = require("../src/db")
// load environment
const env = require("../src/environment")
const {
USER_METDATA_PREFIX,
LINK_USER_METADATA_PREFIX,
} = require("../src/db/utils")
// Script to export a chosen budibase app into a package
// Usage: ./scripts/exportAppTemplate.js export --name=Funky --appId=appId
@ -44,7 +48,13 @@ yargs
// perform couch dump
const instanceDb = new CouchDB(appId)
await instanceDb.dump(writeStream, {})
await instanceDb.dump(writeStream, {
filter: doc =>
!(
doc._id.includes(USER_METDATA_PREFIX) ||
doc.includes(LINK_USER_METADATA_PREFIX)
),
})
console.log(`Template ${name} exported to ${exportPath}`)
}
)