From 85af594004f40e586d756e757d6693158843871a Mon Sep 17 00:00:00 2001 From: ChengLei Shao Date: Wed, 21 Feb 2024 23:18:58 +0800 Subject: [PATCH] chore: limit restore dialect (#3534) --- .../database/src/query-interface/postgres-query-interface.ts | 1 + .../@nocobase/plugin-backup-restore/src/server/restorer.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/database/src/query-interface/postgres-query-interface.ts b/packages/core/database/src/query-interface/postgres-query-interface.ts index 699fdfffd..5e973dc38 100644 --- a/packages/core/database/src/query-interface/postgres-query-interface.ts +++ b/packages/core/database/src/query-interface/postgres-query-interface.ts @@ -17,6 +17,7 @@ export default class PostgresQueryInterface extends QueryInterface { transaction?: Transaction; }): Promise { const { tableInfo, columnName, seqName, currentVal, transaction } = options; + if (!seqName) { throw new Error('seqName is required to set auto increment val in postgres'); } diff --git a/packages/plugins/@nocobase/plugin-backup-restore/src/server/restorer.ts b/packages/plugins/@nocobase/plugin-backup-restore/src/server/restorer.ts index 2331fec26..33edc04de 100644 --- a/packages/plugins/@nocobase/plugin-backup-restore/src/server/restorer.ts +++ b/packages/plugins/@nocobase/plugin-backup-restore/src/server/restorer.ts @@ -91,7 +91,7 @@ export class Restorer extends AppMigrator { async checkMeta() { const meta = await this.getImportMeta(); - if (meta['dialectOnly'] && !this.app.db.inDialect(meta['dialect'])) { + if (!this.app.db.inDialect(meta['dialect'])) { throw new RestoreCheckError(`this backup file can only be imported in database ${meta['dialect']}`); }