This commit is contained in:
mike12345567 2022-12-07 14:43:27 +00:00
parent bffb41490b
commit 4b211b6587
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..") console.log("Enabled cron triggers for deployed app..")
// sync the automations back to the dev DB - since there is now cron // sync the automations back to the dev DB - since there is now cron
// information attached // 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) { 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 { db as dbCore, context } from "@budibase/backend-core"
import sdk from "../../" 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) { if (env.DISABLE_AUTO_PROD_APP_SYNC) {
return { return {
message: message:
@ -35,7 +38,8 @@ export async function syncApp(appId: string, opts?: { automationOnly?: boolean }
try { try {
const replOpts = replication.appReplicateOpts() const replOpts = replication.appReplicateOpts()
if (opts?.automationOnly) { 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() await replication.replicate()
} catch (err) { } catch (err) {