This commit is contained in:
mike12345567 2022-12-07 14:43:27 +00:00
parent 617863ddd1
commit be0b15428b
2 changed files with 9 additions and 3 deletions

View File

@ -89,7 +89,9 @@ async function initDeployedApp(prodAppId: any) {
console.log("Enabled cron triggers for deployed app..")
// sync the automations back to the dev DB - since there is now cron
// information attached
await sdk.applications.syncApp(dbCore.getDevAppID(prodAppId), { automationOnly: true })
await sdk.applications.syncApp(dbCore.getDevAppID(prodAppId), {
automationOnly: true,
})
}
async function deployApp(deployment: any, userId: string) {

View File

@ -2,7 +2,10 @@ import env from "../../../environment"
import { db as dbCore, context } from "@budibase/backend-core"
import sdk from "../../"
export async function syncApp(appId: string, opts?: { automationOnly?: boolean }) {
export async function syncApp(
appId: string,
opts?: { automationOnly?: boolean }
) {
if (env.DISABLE_AUTO_PROD_APP_SYNC) {
return {
message:
@ -35,7 +38,8 @@ export async function syncApp(appId: string, opts?: { automationOnly?: boolean }
try {
const replOpts = replication.appReplicateOpts()
if (opts?.automationOnly) {
replOpts.filter = (doc: any) => doc._id.startsWith(dbCore.DocumentType.AUTOMATION)
replOpts.filter = (doc: any) =>
doc._id.startsWith(dbCore.DocumentType.AUTOMATION)
}
await replication.replicate()
} catch (err) {