fix: ingore migration collection backup
Signed-off-by: Innei <i@innei.in>
This commit is contained in:
@@ -12,7 +12,7 @@ export const CATEGORY_COLLECTION_NAME = 'categories'
|
||||
export const COMMENT_COLLECTION_NAME = 'comments'
|
||||
export const RECENTLY_COLLECTION_NAME = 'recentlies'
|
||||
|
||||
export const Analyze_COLLECTION_NAME = 'analyzes'
|
||||
export const ANALYZE_COLLECTION_NAME = 'analyzes'
|
||||
export const WEBHOOK_EVENT_COLLECTION_NAME = 'webhook_events'
|
||||
|
||||
export enum CollectionRefTypes {
|
||||
|
||||
@@ -9,8 +9,6 @@ import {
|
||||
import { defineMigration } from '../helper'
|
||||
|
||||
export default defineMigration('v4.6.2__0', async (db, connection) => {
|
||||
const session = await connection.startSession()
|
||||
session.startTransaction()
|
||||
try {
|
||||
await Promise.all([
|
||||
db
|
||||
@@ -68,12 +66,8 @@ export default defineMigration('v4.6.2__0', async (db, connection) => {
|
||||
},
|
||||
},
|
||||
])
|
||||
await session.commitTransaction()
|
||||
} catch {
|
||||
await session.abortTransaction()
|
||||
|
||||
} catch (err) {
|
||||
console.error('v4.6.2 migration failed')
|
||||
} finally {
|
||||
session.endSession()
|
||||
throw err
|
||||
}
|
||||
})
|
||||
|
||||
@@ -3,7 +3,7 @@ import { UAParser } from 'ua-parser-js'
|
||||
|
||||
import { index, modelOptions, prop, Severity } from '@typegoose/typegoose'
|
||||
|
||||
import { Analyze_COLLECTION_NAME } from '~/constants/db.constant'
|
||||
import { ANALYZE_COLLECTION_NAME } from '~/constants/db.constant'
|
||||
import { BaseModel } from '~/shared/model/base.model'
|
||||
|
||||
@modelOptions({
|
||||
@@ -14,7 +14,7 @@ import { BaseModel } from '~/shared/model/base.model'
|
||||
},
|
||||
},
|
||||
options: {
|
||||
customName: Analyze_COLLECTION_NAME,
|
||||
customName: ANALYZE_COLLECTION_NAME,
|
||||
allowMixed: Severity.ALLOW,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -17,7 +17,8 @@ import { CronDescription } from '~/common/decorators/cron-description.decorator'
|
||||
import { CronOnce } from '~/common/decorators/cron-once.decorator'
|
||||
import { BusinessEvents, EventScope } from '~/constants/business-event.constant'
|
||||
import {
|
||||
Analyze_COLLECTION_NAME,
|
||||
ANALYZE_COLLECTION_NAME,
|
||||
MIGRATE_COLLECTION_NAME,
|
||||
WEBHOOK_EVENT_COLLECTION_NAME,
|
||||
} from '~/constants/db.constant'
|
||||
import { BACKUP_DIR, DATA_DIR } from '~/constants/path.constant'
|
||||
@@ -31,8 +32,9 @@ import { getFolderSize, installPKG } from '~/utils/system.util'
|
||||
import { ConfigsService } from '../configs/configs.service'
|
||||
|
||||
const excludeCollections = [
|
||||
Analyze_COLLECTION_NAME,
|
||||
ANALYZE_COLLECTION_NAME,
|
||||
WEBHOOK_EVENT_COLLECTION_NAME,
|
||||
MIGRATE_COLLECTION_NAME,
|
||||
]
|
||||
@Injectable()
|
||||
export class BackupService {
|
||||
|
||||
Reference in New Issue
Block a user