fix: loss of precision updating BIGINT values, fixes #467

This commit is contained in:
Fabio Di Stasio 2022-10-26 12:26:09 +02:00
parent d8a298fd20
commit d190a2dd61
3 changed files with 22 additions and 7 deletions

View File

@ -47,6 +47,12 @@ export const FLOAT = [
'MONEY'
];
export const IS_BIGINT = [
'BIGINT',
'BIGSERIAL',
'DOUBLE PRECISION'
];
export const BOOLEAN = [
'BOOL',
'BOOLEAN'

View File

@ -7,7 +7,7 @@
:option-label="(opt: any) => opt.name === 'manual' ? t('message.manualValue') : t(`faker.${opt.name}`)"
option-track-by="name"
:disabled="!isChecked"
style="flex-grow: 0;"
:style="'flex-grow: 0;'"
@change="onChange"
/>
@ -87,7 +87,7 @@
<script setup lang="ts">
import { computed, PropType, Ref, ref, watch } from 'vue';
import { TEXT, LONG_TEXT, NUMBER, FLOAT, DATE, TIME, DATETIME, BLOB, BIT, UUID } from 'common/fieldTypes';
import { TEXT, LONG_TEXT, NUMBER, FLOAT, DATE, TIME, DATETIME, BLOB, BIT, UUID, IS_BIGINT } from 'common/fieldTypes';
import BaseUploadInput from '@/components/BaseUploadInput.vue';
import ForeignKeySelect from '@/components/ForeignKeySelect.vue';
import FakerMethods from 'common/FakerMethods';
@ -146,8 +146,12 @@ const inputProps = () => {
if ([...TEXT, ...LONG_TEXT].includes(props.type))
return { type: 'text', mask: false };
if ([...NUMBER, ...FLOAT].includes(props.type))
if ([...NUMBER, ...FLOAT].includes(props.type)) {
if (IS_BIGINT.includes(props.type))
return { type: 'text', mask: false };
else
return { type: 'number', mask: false };
}
if (TIME.includes(props.type)) {
let timeMask = '##:##:##';

View File

@ -220,7 +220,8 @@ import {
BINARY,
HAS_TIMEZONE,
SPATIAL,
IS_MULTI_SPATIAL
IS_MULTI_SPATIAL,
IS_BIGINT
} from 'common/fieldTypes';
import ConfirmModal from '@/components/BaseConfirmModal.vue';
import TextEditor from '@/components/BaseTextEditor.vue';
@ -281,8 +282,12 @@ const inputProps = computed(() => {
if ([...TEXT, ...LONG_TEXT].includes(editingType.value))
return { type: 'text', mask: false };
if ([...NUMBER, ...FLOAT].includes(editingType.value))
if ([...NUMBER, ...FLOAT].includes(editingType.value)) {
if (IS_BIGINT.includes(editingType.value))
return { type: 'text', mask: false };
else
return { type: 'number', mask: false };
}
if (TIME.includes(editingType.value)) {
let timeMask = '##:##:##';