Treat bigint as string (#8877)
* Make bigint string type * Handle BigInt relationships * remove unused var * Revert CreateEditRelationship modal changes
This commit is contained in:
parent
403d7eb164
commit
19696fb1fe
|
@ -147,7 +147,8 @@ class MySQLIntegration extends Sql implements DatasourcePlus {
|
||||||
if (
|
if (
|
||||||
field.type == "DATETIME" ||
|
field.type == "DATETIME" ||
|
||||||
field.type === "DATE" ||
|
field.type === "DATE" ||
|
||||||
field.type === "TIMESTAMP"
|
field.type === "TIMESTAMP" ||
|
||||||
|
field.type === "LONGLONG"
|
||||||
) {
|
) {
|
||||||
return field.string()
|
return field.string()
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ const ROW_ID_REGEX = /^\[.*]$/g
|
||||||
const SQL_NUMBER_TYPE_MAP = {
|
const SQL_NUMBER_TYPE_MAP = {
|
||||||
integer: FieldTypes.NUMBER,
|
integer: FieldTypes.NUMBER,
|
||||||
int: FieldTypes.NUMBER,
|
int: FieldTypes.NUMBER,
|
||||||
bigint: FieldTypes.NUMBER,
|
|
||||||
decimal: FieldTypes.NUMBER,
|
decimal: FieldTypes.NUMBER,
|
||||||
smallint: FieldTypes.NUMBER,
|
smallint: FieldTypes.NUMBER,
|
||||||
real: FieldTypes.NUMBER,
|
real: FieldTypes.NUMBER,
|
||||||
|
@ -47,6 +46,7 @@ const SQL_STRING_TYPE_MAP = {
|
||||||
blob: FieldTypes.STRING,
|
blob: FieldTypes.STRING,
|
||||||
long: FieldTypes.STRING,
|
long: FieldTypes.STRING,
|
||||||
text: FieldTypes.STRING,
|
text: FieldTypes.STRING,
|
||||||
|
bigint: FieldTypes.STRING,
|
||||||
}
|
}
|
||||||
|
|
||||||
const SQL_BOOLEAN_TYPE_MAP = {
|
const SQL_BOOLEAN_TYPE_MAP = {
|
||||||
|
@ -141,12 +141,18 @@ export function breakRowIdField(_id: string | { _id: string }): any[] {
|
||||||
export function convertSqlType(type: string) {
|
export function convertSqlType(type: string) {
|
||||||
let foundType = FieldTypes.STRING
|
let foundType = FieldTypes.STRING
|
||||||
const lcType = type.toLowerCase()
|
const lcType = type.toLowerCase()
|
||||||
|
let matchingTypes = []
|
||||||
for (let [external, internal] of Object.entries(SQL_TYPE_MAP)) {
|
for (let [external, internal] of Object.entries(SQL_TYPE_MAP)) {
|
||||||
if (lcType.includes(external)) {
|
if (lcType.includes(external)) {
|
||||||
foundType = internal
|
matchingTypes.push({ external, internal })
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Set the foundType based the longest match
|
||||||
|
if (matchingTypes.length > 0) {
|
||||||
|
foundType = matchingTypes.reduce((acc, val) => {
|
||||||
|
return acc.external.length >= val.external.length ? acc : val
|
||||||
|
}).internal
|
||||||
|
}
|
||||||
const schema: any = { type: foundType }
|
const schema: any = { type: foundType }
|
||||||
if (foundType === FieldTypes.DATETIME) {
|
if (foundType === FieldTypes.DATETIME) {
|
||||||
schema.dateOnly = SQL_DATE_ONLY_TYPES.includes(lcType)
|
schema.dateOnly = SQL_DATE_ONLY_TYPES.includes(lcType)
|
||||||
|
|
Loading…
Reference in New Issue