mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-08 06:59:26 +08:00
fix: unable to create a MySQL view
This commit is contained in:
parent
fd7c839228
commit
441e94ec14
@ -392,7 +392,6 @@ export class Collection<
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fieldName = options.field || snakeCase(name);
|
const fieldName = options.field || snakeCase(name);
|
||||||
|
|
||||||
const field = this.findField((f) => {
|
const field = this.findField((f) => {
|
||||||
if (f.name === name) {
|
if (f.name === name) {
|
||||||
return false;
|
return false;
|
||||||
@ -406,10 +405,20 @@ export class Collection<
|
|||||||
if (!field) {
|
if (!field) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (options.type === field.type) {
|
||||||
if (options.type !== field.type) {
|
return;
|
||||||
throw new Error(`fields with same column must be of the same type ${JSON.stringify(options)}`);
|
|
||||||
}
|
}
|
||||||
|
const isContextTypeMatch = (data, dataType: string): boolean => {
|
||||||
|
return [data.dataType?.key, data.type?.toUpperCase()].includes(dataType?.toUpperCase());
|
||||||
|
};
|
||||||
|
if (options.type === 'context' && isContextTypeMatch(field, options.dataType)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (field.type === 'context' && isContextTypeMatch(options, field.dataType.key)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(`fields with same column must be of the same type ${JSON.stringify(options)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user