mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-04 21:19:27 +08:00
fix: missing schema
This commit is contained in:
parent
1a85719657
commit
c4b819528a
@ -28,9 +28,8 @@ export default class extends Migration {
|
||||
|
||||
for (const treeCollection of treeCollections) {
|
||||
const name = `main_${treeCollection.name}_path`;
|
||||
this.app.db.collection({
|
||||
const collectionOptions = {
|
||||
name,
|
||||
schema: treeCollection.options.schema,
|
||||
autoGenId: false,
|
||||
timestamps: false,
|
||||
fields: [
|
||||
@ -43,20 +42,27 @@ export default class extends Migration {
|
||||
fields: [{ name: 'path', length: 191 }],
|
||||
},
|
||||
],
|
||||
});
|
||||
};
|
||||
if (treeCollection.options.schema) {
|
||||
collectionOptions['schema'] = treeCollection.options.schema;
|
||||
}
|
||||
this.app.db.collection(collectionOptions);
|
||||
const treeExistsInDb = await this.app.db.getCollection(name).existsInDb({ transaction });
|
||||
if (!treeExistsInDb) {
|
||||
await this.app.db.getCollection(name).sync({ transaction } as SyncOptions);
|
||||
this.app.db.collection({
|
||||
const opts = {
|
||||
name: treeCollection.name,
|
||||
schema: treeCollection.options.schema,
|
||||
autoGenId: false,
|
||||
timestamps: false,
|
||||
fields: [
|
||||
{ type: 'integer', name: 'id' },
|
||||
{ type: 'integer', name: 'parentId' },
|
||||
],
|
||||
});
|
||||
};
|
||||
if (treeCollection.options.schema) {
|
||||
opts['schema'] = treeCollection.options.schema;
|
||||
}
|
||||
this.app.db.collection(opts);
|
||||
const chunkSize = 1000;
|
||||
await this.app.db.getRepository(treeCollection.name).chunk({
|
||||
chunkSize: chunkSize,
|
||||
|
Loading…
x
Reference in New Issue
Block a user