mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 05:29:26 +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) {
|
for (const treeCollection of treeCollections) {
|
||||||
const name = `main_${treeCollection.name}_path`;
|
const name = `main_${treeCollection.name}_path`;
|
||||||
this.app.db.collection({
|
const collectionOptions = {
|
||||||
name,
|
name,
|
||||||
schema: treeCollection.options.schema,
|
|
||||||
autoGenId: false,
|
autoGenId: false,
|
||||||
timestamps: false,
|
timestamps: false,
|
||||||
fields: [
|
fields: [
|
||||||
@ -43,20 +42,27 @@ export default class extends Migration {
|
|||||||
fields: [{ name: 'path', length: 191 }],
|
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 });
|
const treeExistsInDb = await this.app.db.getCollection(name).existsInDb({ transaction });
|
||||||
if (!treeExistsInDb) {
|
if (!treeExistsInDb) {
|
||||||
await this.app.db.getCollection(name).sync({ transaction } as SyncOptions);
|
await this.app.db.getCollection(name).sync({ transaction } as SyncOptions);
|
||||||
this.app.db.collection({
|
const opts = {
|
||||||
name: treeCollection.name,
|
name: treeCollection.name,
|
||||||
schema: treeCollection.options.schema,
|
|
||||||
autoGenId: false,
|
autoGenId: false,
|
||||||
timestamps: false,
|
timestamps: false,
|
||||||
fields: [
|
fields: [
|
||||||
{ type: 'integer', name: 'id' },
|
{ type: 'integer', name: 'id' },
|
||||||
{ type: 'integer', name: 'parentId' },
|
{ type: 'integer', name: 'parentId' },
|
||||||
],
|
],
|
||||||
});
|
};
|
||||||
|
if (treeCollection.options.schema) {
|
||||||
|
opts['schema'] = treeCollection.options.schema;
|
||||||
|
}
|
||||||
|
this.app.db.collection(opts);
|
||||||
const chunkSize = 1000;
|
const chunkSize = 1000;
|
||||||
await this.app.db.getRepository(treeCollection.name).chunk({
|
await this.app.db.getRepository(treeCollection.name).chunk({
|
||||||
chunkSize: chunkSize,
|
chunkSize: chunkSize,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user