Merge branch 'main' into next

This commit is contained in:
GitHub Actions Bot 2024-08-09 11:37:53 +00:00
commit 99070be46d

View File

@ -7,14 +7,14 @@
* For more information, please refer to: https://www.nocobase.com/agreement. * For more information, please refer to: https://www.nocobase.com/agreement.
*/ */
import { Model } from './model'; import { isPlainObject } from '@nocobase/utils';
import { Model as SequelizeModel } from 'sequelize';
import { Collection } from './collection'; import { Collection } from './collection';
import Database from './database'; import Database from './database';
import { InheritedSyncRunner } from './inherited-sync-runner';
import { InheritedCollection } from './inherited-collection';
import { Model as SequelizeModel } from 'sequelize';
import { ZeroColumnTableError } from './errors/zero-column-table-error'; import { ZeroColumnTableError } from './errors/zero-column-table-error';
import { isPlainObject } from '@nocobase/utils'; import { InheritedCollection } from './inherited-collection';
import { InheritedSyncRunner } from './inherited-sync-runner';
import { Model } from './model';
export class SyncRunner { export class SyncRunner {
private readonly collection: Collection; private readonly collection: Collection;
@ -74,14 +74,17 @@ export class SyncRunner {
throw e; throw e;
} }
let beforeColumns;
try { try {
const beforeColumns = await this.queryInterface.describeTable(this.tableName, options); beforeColumns = await this.queryInterface.describeTable(this.tableName, options);
} catch (error) {
// continue
}
if (beforeColumns) {
await this.handlePrimaryKeyBeforeSync(beforeColumns, options); await this.handlePrimaryKeyBeforeSync(beforeColumns, options);
await this.handleUniqueFieldBeforeSync(beforeColumns, options); await this.handleUniqueFieldBeforeSync(beforeColumns, options);
} catch (e) {
if (!e.message.includes('No description found')) {
throw e;
}
} }
const syncResult = await this.performSync(options); const syncResult = await this.performSync(options);