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

View File

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

View File

@ -11,6 +11,7 @@ async function importProcessor(job: Job) {
const appId = data.appId, const appId = data.appId,
backupId = data.import!.backupId backupId = data.import!.backupId
const { path, metadata } = await backups.downloadAppBackup(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) { 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 DB_EXPORT_FILE = "db.txt"
export const ATTACHMENT_DIR = attachmentDir
export const GLOBAL_DB_EXPORT_FILE = "global.txt" export const GLOBAL_DB_EXPORT_FILE = "global.txt"

View File

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