Skip to content

Commit

Permalink
fix: loss of precision updating BIGINT values, fixes #467
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Oct 26, 2022
1 parent d8a298f commit d190a2d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
6 changes: 6 additions & 0 deletions src/common/fieldTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ export const FLOAT = [
'MONEY'
];

export const IS_BIGINT = [
'BIGINT',
'BIGSERIAL',
'DOUBLE PRECISION'
];

export const BOOLEAN = [
'BOOL',
'BOOLEAN'
Expand Down
12 changes: 8 additions & 4 deletions src/renderer/components/FakerSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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"
/>

Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -146,8 +146,12 @@ const inputProps = () => {
if ([...TEXT, ...LONG_TEXT].includes(props.type))
return { type: 'text', mask: false };
if ([...NUMBER, ...FLOAT].includes(props.type))
return { type: 'number', mask: false };
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 = '##:##:##';
Expand Down
11 changes: 8 additions & 3 deletions src/renderer/components/WorkspaceTabQueryTableRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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))
return { type: 'number', mask: false };
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 = '##:##:##';
Expand Down

0 comments on commit d190a2d

Please sign in to comment.