fix: schema-uid-invalid (#2107)
This commit is contained in:
parent
40c1a2b2ce
commit
7bd3168422
@ -1,9 +1,10 @@
|
||||
import { Model } from '@nocobase/database';
|
||||
import { Migration } from '@nocobase/server';
|
||||
|
||||
export default class extends Migration {
|
||||
async up() {
|
||||
const systemSettings = this.db.getRepository('systemSettings');
|
||||
const instance = await systemSettings.findOne();
|
||||
let instance: Model = await systemSettings.findOne();
|
||||
const uiRoutes = this.db.getRepository('uiRoutes');
|
||||
const routes = await uiRoutes.find();
|
||||
for (const route of routes) {
|
||||
@ -11,10 +12,15 @@ export default class extends Migration {
|
||||
const options = instance.options || {};
|
||||
options['adminSchemaUid'] = route.uiSchemaUid;
|
||||
instance.set('options', options);
|
||||
console.log('options.adminSchemaUid', route.uiSchemaUid);
|
||||
instance.changed('options', true);
|
||||
await instance.save();
|
||||
return;
|
||||
}
|
||||
}
|
||||
instance = await systemSettings.findOne();
|
||||
if (!instance.get('options')?.mobileSchemaUid) {
|
||||
throw new Error('adminSchemaUid invalid');
|
||||
}
|
||||
this.app.log.info('systemSettings.options', instance.toJSON());
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
import { Model } from '@nocobase/database';
|
||||
import { Migration } from '@nocobase/server';
|
||||
|
||||
export default class extends Migration {
|
||||
async up() {
|
||||
const systemSettings = this.db.getRepository('systemSettings');
|
||||
const instance = await systemSettings.findOne();
|
||||
let instance: Model = await systemSettings.findOne();
|
||||
const uiRoutes = this.db.getRepository('uiRoutes');
|
||||
const routes = await uiRoutes.find();
|
||||
for (const route of routes) {
|
||||
@ -11,10 +12,15 @@ export default class extends Migration {
|
||||
const options = instance.options || {};
|
||||
options['mobileSchemaUid'] = route.uiSchemaUid;
|
||||
instance.set('options', options);
|
||||
console.log('options.mobileSchemaUid', route.uiSchemaUid);
|
||||
instance.changed('options', true);
|
||||
await instance.save();
|
||||
return;
|
||||
}
|
||||
}
|
||||
instance = await systemSettings.findOne();
|
||||
if (!instance.get('options')?.mobileSchemaUid) {
|
||||
throw new Error('mobileSchemaUid invalid');
|
||||
}
|
||||
this.app.log.info('systemSettings.options', instance.toJSON());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user