fix: ingore migration collection backup

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei
2024-01-02 22:16:47 +08:00
parent 668a9af136
commit 813aa351b1
4 changed files with 9 additions and 13 deletions

View File

@@ -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 {

View File

@@ -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
}
})

View File

@@ -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,
},
})

View File

@@ -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 {