|
|
@ -102,21 +102,17 @@ export const fieldRequiredValidator = () => { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const fieldLengthValidator = (sqlClientType: string) => { |
|
|
|
export const fieldLengthValidator = () => { |
|
|
|
return { |
|
|
|
return { |
|
|
|
validator: (rule: any, value: any) => { |
|
|
|
validator: (rule: any, value: any) => { |
|
|
|
const { t } = getI18n().global |
|
|
|
const { t } = getI18n().global |
|
|
|
|
|
|
|
|
|
|
|
// no limit for sqlite but set as 255
|
|
|
|
/// mysql allows 64 characters for column_name
|
|
|
|
let fieldLengthLimit = 255 |
|
|
|
// postgres allows 59 characters for column_name
|
|
|
|
|
|
|
|
// mssql allows 128 characters for column_name
|
|
|
|
if (sqlClientType === 'mysql2' || sqlClientType === 'mysql') { |
|
|
|
// sqlite allows any number of characters for column_name
|
|
|
|
fieldLengthLimit = 64 |
|
|
|
// We allow 255 for all databases, truncate will be handled by backend for column_name
|
|
|
|
} else if (sqlClientType === 'pg') { |
|
|
|
const fieldLengthLimit = 255 |
|
|
|
fieldLengthLimit = 59 |
|
|
|
|
|
|
|
} else if (sqlClientType === 'mssql') { |
|
|
|
|
|
|
|
fieldLengthLimit = 128 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
if (value?.length > fieldLengthLimit) { |
|
|
|
if (value?.length > fieldLengthLimit) { |
|
|
|