fix
This commit is contained in:
parent
ef4c14cb8f
commit
9771281430
|
|
@ -151,12 +151,8 @@ export const execQuery = async (args: DBArg, prisma: any) => {
|
|||
return rels;
|
||||
} else if (action === "schema_columns") {
|
||||
for (const col of schema_table.properties) {
|
||||
if (
|
||||
col.type === "field" &&
|
||||
!col.array &&
|
||||
col.attributes &&
|
||||
col.attributes?.length > 0
|
||||
) {
|
||||
if (col.type === "field" && !col.array) {
|
||||
if (col.attributes && col.attributes?.length > 0) {
|
||||
const attr = col.attributes.find(
|
||||
(e) => e.name !== "id" && e.name !== "default"
|
||||
);
|
||||
|
|
@ -166,18 +162,29 @@ export const execQuery = async (args: DBArg, prisma: any) => {
|
|||
);
|
||||
const is_pk = col.attributes.find((e) => e.name === "id");
|
||||
|
||||
if (attr && attr.name !== "relation") {
|
||||
let type = "String";
|
||||
if (typeof col.fieldType === "string") type = col.fieldType;
|
||||
|
||||
if ((attr && attr.name !== "relation") || !attr) {
|
||||
columns[col.name] = {
|
||||
is_pk: !!is_pk,
|
||||
type: type.toLowerCase(),
|
||||
optional: !!col.optional,
|
||||
db_type: attr.name.toLowerCase(),
|
||||
db_type: attr
|
||||
? attr.name.toLowerCase()
|
||||
: type.toLowerCase(),
|
||||
default: default_val,
|
||||
};
|
||||
}
|
||||
} else if (typeof col.fieldType === "string") {
|
||||
columns[col.name] = {
|
||||
is_pk: false,
|
||||
type: col.fieldType.toLowerCase(),
|
||||
optional: !!col.optional,
|
||||
db_type: col.fieldType.toLowerCase(),
|
||||
default: null,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
return columns;
|
||||
|
|
|
|||
Loading…
Reference in New Issue