chore: view inference (#3060)
This commit is contained in:
parent
0acd7b6dd3
commit
eac8559104
@ -102,7 +102,14 @@ export class ViewFieldInference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!inferResult.type) {
|
if (!inferResult.type) {
|
||||||
Object.assign(inferResult, this.inferToFieldType({ db, name, type: column.type }));
|
Object.assign(
|
||||||
|
inferResult,
|
||||||
|
this.inferToFieldType({
|
||||||
|
dialect: db.sequelize.getDialect(),
|
||||||
|
name,
|
||||||
|
type: column.type,
|
||||||
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
rawFields.push([name, inferResult]);
|
rawFields.push([name, inferResult]);
|
||||||
@ -111,9 +118,8 @@ export class ViewFieldInference {
|
|||||||
return Object.fromEntries(rawFields);
|
return Object.fromEntries(rawFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inferToFieldType(options: { db: Database; name: string; type: string }) {
|
static inferToFieldType(options: { name: string; type: string; dialect: string }) {
|
||||||
const { db } = options;
|
const { dialect } = options;
|
||||||
const dialect = db.sequelize.getDialect();
|
|
||||||
const fieldTypeMap = FieldTypeMap[dialect];
|
const fieldTypeMap = FieldTypeMap[dialect];
|
||||||
|
|
||||||
if (!options.type) {
|
if (!options.type) {
|
||||||
|
Loading…
Reference in New Issue
Block a user