mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Only treat tinyint(1) and tinyint(0) as booleans (#7287)
* added an if catch for tinyint(1) and tinyint(0) * made suggested changes toLowerCase()
This commit is contained in:
@@ -6,7 +6,7 @@ import getDatabase from '../database';
|
||||
const localTypeMap: Record<string, { type: Type; useTimezone?: boolean }> = {
|
||||
// Shared
|
||||
boolean: { type: 'boolean' },
|
||||
tinyint: { type: 'boolean' },
|
||||
tinyint: { type: 'integer' },
|
||||
smallint: { type: 'integer' },
|
||||
mediumint: { type: 'integer' },
|
||||
int: { type: 'integer' },
|
||||
@@ -117,7 +117,6 @@ export default function getLocalType(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Handle Postgres numeric decimals */
|
||||
if (column.data_type === 'numeric' && column.numeric_precision !== null && column.numeric_scale !== null) {
|
||||
return 'decimal';
|
||||
@@ -128,6 +127,11 @@ export default function getLocalType(
|
||||
return 'text';
|
||||
}
|
||||
|
||||
/** Handle Boolean as TINYINT*/
|
||||
if (column.data_type.toLowerCase() === 'tinyint(1)' || column.data_type.toLowerCase() === 'tinyint(0)') {
|
||||
return 'boolean';
|
||||
}
|
||||
|
||||
if (type) {
|
||||
return type.type;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user