* feat: association field * fix: bug * refactor: association field * style: style improve * style: style improve * refactor: support subtable * refactor: support file collection * refactor: locale improve * refactor: subtable improve * refactor: association select improve * refactor: association select improve * refactor: association select improve * refactor: useAssociationNames * refactor: enable link * refactor: selector * refactor: selector * refactor: locale improve * refactor: on demand loading of relational data * refactor: locale improve * refactor: select button * refactor: association field * refactor: formformBlock provider * refactor: formformBlock provider * refactor: internalSelect recordPicker * refactor: formBlocklockProvider * fix: addNewer schema * fix: useServiceOptions * fix: useCreateActionProps * fix: useCreateActionProps * refactor: nester delete * refactor: nester delete in detail * refactor: subTable suport select * refactor: subTable suport select * style: style improve * style: style improve * chore: fileManger * fix: association readPrety * fix: filemanger * refactor: field mode * refactor: enable link * chore: error message * refactor: association schemaInitialize * refactor: association schemaInitialize * refactor: currentMode * refactor: field mode default value * fix: file manage readPretty * fix: appends * chore: file manage readPretty * fix: updateAssociationValues * fix: updateAssociationValues * fix: updateAssociationValues * fix: nester appends * fix: nester appends * fix: tree collection association fields * fix: tree collection association fields * fix: nester appends * fix: subtable to select field value missing * fix: subtable to select field value missing * fix: compatible with historical blocks * fix: compatible with historical blocks * fix: compatible with historical blocks * feat: add migration * fix: filter block allow add new * fix: compatible with historical blocks * fix: skip if not RecordPicker * fix: compatible with historical blocks * fix: detail block not support nester * fix: association select support data scope and sort setting * fix: appends on demand loading * fix: asociationSelect support multiple * fix: recordPicker -> AssociationField * fix: add migration * fix: audit logs not show assication data * fix: flattenNestedList * refactor: file manager field mode * refactor: field mode refactor * fix: subtable action * fix: subtable appends * refactor: code improve * fix: nester add new * feat: sub table * fix: data scope not effect immediately * fix: association add new * fix: association field failed to add new and mutual influence * style: style improve * style: style improve * refactor: updateAssociationValues * refactor: form init values * refactor: select options * fix: form initialValues * fix: record picker values * fix: field value change when field mode change * fix: select data scope * feat: add migration * fix: table column enable link * fix: table column enable link * refactor: locale improve * fix: migration * fix: mutiple config * fix: readPretty enable link * fix: appends on demand * fix: enable link style * refactor: locale improve * refactor: locale improve * feat: sub-form migration * fix: skip migration * fix: translation * fix: skip migration * fix: getLabelFormatValue * fix: error TS2339: Property 'find' does not exist on type 'string | SchemaEnum<any>' * refactor: remove the logic code for converting old record picker * refactor: locale * refactor: locale * fix: sub-table should not support add new * refactor: code improve * refactor: locale * fix: compatibility history Subtable * fix: improve --------- Co-authored-by: chenos <chenlinxh@gmail.com> Co-authored-by: Chareice <chareice@live.com>
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { Migration } from '@nocobase/server';
|
|
|
|
export default class extends Migration {
|
|
async up() {
|
|
const result = await this.app.version.satisfies('<0.9.2-alpha.5');
|
|
if (!result) {
|
|
return;
|
|
}
|
|
const r = this.db.getRepository('uiSchemas');
|
|
const items = await r.find({
|
|
filter: {
|
|
'schema.x-designer': 'AssociationSelect.Designer',
|
|
},
|
|
});
|
|
await this.db.sequelize.transaction(async (transaction) => {
|
|
for (const item of items) {
|
|
const schema = item.schema;
|
|
if (!schema['x-collection-field']) {
|
|
continue;
|
|
}
|
|
const field = this.db.getFieldByPath(schema['x-collection-field']);
|
|
if (!field) {
|
|
continue;
|
|
}
|
|
if (['hasOne', 'belongsTo'].includes(field.type)) {
|
|
schema['type'] = 'object';
|
|
} else if (['hasMany', 'belongsToMany'].includes(field.type)) {
|
|
schema['type'] = 'array';
|
|
} else {
|
|
continue;
|
|
}
|
|
schema['x-designer'] = 'FormItem.Designer';
|
|
schema['x-component'] = 'CollectionField';
|
|
item.set('schema', schema);
|
|
await item.save({ transaction });
|
|
}
|
|
});
|
|
}
|
|
}
|