Moved special check above localTypeMap check. (#6208)

This commit is contained in:
Oreille
2021-06-11 14:59:20 +02:00
committed by GitHub
parent 31fbb5f06f
commit 46c77f70c8

View File

@@ -93,6 +93,14 @@ export default function getLocalType(
): typeof types[number] | 'unknown' {
const type = localTypeMap[column.data_type.toLowerCase().split('(')[0]];
const special = field?.special;
if (special) {
if (special.includes('json')) return 'json';
if (special.includes('hash')) return 'hash';
if (special.includes('csv')) return 'csv';
if (special.includes('uuid')) return 'uuid';
}
/** Handle Postgres numeric decimals */
if (column.data_type === 'numeric' && column.numeric_precision !== null && column.numeric_scale !== null) {
return 'decimal';
@@ -103,11 +111,6 @@ export default function getLocalType(
return 'text';
}
if (field?.special?.includes('json')) return 'json';
if (field?.special?.includes('hash')) return 'hash';
if (field?.special?.includes('csv')) return 'csv';
if (field?.special?.includes('uuid')) return 'uuid';
if (type) {
return type.type;
}