Removing attachment dir constant - no longer needed.

This commit is contained in:
mike12345567 2022-10-18 17:04:18 +01:00
parent bd1300b82a
commit ed35a8281f
5 changed files with 17 additions and 17 deletions

View File

@ -1,23 +1,25 @@
import Deployment from "./Deployment"
import {
Replication,
getProdAppID,
getDevelopmentAppID,
getProdAppID,
Replication,
} from "@budibase/backend-core/db"
import { DocumentType, getAutomationParams } from "../../../db/utils"
import {
clearMetadata,
disableAllCrons,
enableCronTrigger,
clearMetadata,
} from "../../../automations/utils"
import { app as appCache } from "@budibase/backend-core/cache"
import {
getAppId,
getAppDB,
getProdAppDB,
getAppId,
getDevAppDB,
getProdAppDB,
} from "@budibase/backend-core/context"
import { events } from "@budibase/backend-core"
import { backups } from "@budibase/pro"
import { AppBackupTrigger } from "@budibase/types"
// the max time we can wait for an invalidation to complete before considering it failed
const MAX_PENDING_TIME_MS = 30 * 60000
@ -98,13 +100,18 @@ async function initDeployedApp(prodAppId: any) {
console.log("Enabled cron triggers for deployed app..")
}
async function deployApp(deployment: any) {
async function deployApp(deployment: any, userId: string) {
let replication
try {
const appId = getAppId()
const devAppId = getDevelopmentAppID(appId)
const productionAppId = getProdAppID(appId)
// trigger backup initially
await backups.triggerAppBackup(productionAppId, AppBackupTrigger.PUBLISH, {
createdBy: userId,
})
const config: any = {
source: devAppId,
target: productionAppId,
@ -205,7 +212,7 @@ const _deployApp = async function (ctx: any) {
console.log("Deploying app...")
let app = await deployApp(deployment)
let app = await deployApp(deployment, ctx.user._id)
await events.app.published(app)
ctx.body = deployment

View File

@ -209,6 +209,4 @@ exports.AutomationErrors = {
// pass through the list from the auth/core lib
exports.ObjectStoreBuckets = objectStore.ObjectStoreBuckets
exports.ATTACHMENT_DIR = "attachments"
exports.MAX_AUTOMATION_RECURRING_ERRORS = 5

View File

@ -11,6 +11,7 @@ async function importProcessor(job: Job) {
const appId = data.appId,
backupId = data.import!.backupId
const { path, metadata } = await backups.downloadAppBackup(backupId)
// start by removing app database and contents of bucket - which will be updated
}
async function exportProcessor(job: Job) {

View File

@ -1,4 +1,2 @@
import { ATTACHMENT_DIR as attachmentDir } from "../../../constants"
export const DB_EXPORT_FILE = "db.txt"
export const ATTACHMENT_DIR = attachmentDir
export const GLOBAL_DB_EXPORT_FILE = "global.txt"

View File

@ -1,17 +1,13 @@
import { db as dbCore } from "@budibase/backend-core"
import { TABLE_ROW_PREFIX } from "../../../db/utils"
import { budibaseTempDir } from "../../../utilities/budibaseDir"
import {
DB_EXPORT_FILE,
ATTACHMENT_DIR,
GLOBAL_DB_EXPORT_FILE,
} from "./constants"
import { DB_EXPORT_FILE, GLOBAL_DB_EXPORT_FILE } from "./constants"
import {
uploadDirectory,
upload,
} from "../../../utilities/fileSystem/utilities"
import { ObjectStoreBuckets, FieldTypes } from "../../../constants"
import { join, basename } from "path"
import { join } from "path"
import fs from "fs"
import sdk from "../../"
import { CouchFindOptions, RowAttachment } from "@budibase/types"